Spring rest docs request url shows value for path parameter instead of the parameter name

1k Views Asked by At

I use spring rest docs to document my api.

Now I want to document my document my path in the form of

.../accounts/{userId}

but I get

.../accounts/123

The test part look as follows:

 mockMvc.perform(RestDocumentationRequestBuilders.get("/accounts/{userId}",123)
.
.
.
.andDo(document("{methodName}",
                    preprocessRequest(prettyPrint()),
                    preprocessResponse(prettyPrint()),
                    pathParameters(
                            parameterWithName("userId").description("userId of the requested user.")

In my index.html, the path params are documented like I expect. What I found was that the table header of my path parameter docs is just the way I want it:

enter image description here

So had a look at the default snippets. Here I found the following:

Docs

So it seems that there is/was a problem with the curly brackets. I tried to copy that +{{path}}+ in a custom http-request.snippet. No success. I also tried to remove the nowrap option but again, the in the path the value shown insted of the variable name. Can someone tell me what might be the problem here? I hope I geave enough details.

0

There are 0 best solutions below