我使用 spring rest docs 来记录我的 api。
现在我想以以下形式记录我的文档我的路径
.../accounts/{userId}
但我明白了
.../accounts/123
测试部分如下所示:
mockMvc.perform(RestDocumentationRequestBuilders.get("/accounts/{userId}",123)
.
.
.
.andDo(document("{methodName}",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
pathParameters(
parameterWithName("userId").description("userId of the requested user.")
在我的 index.html 中,路径参数的记录与我期望的一样。我发现我的路径参数文档的表头正是我想要的方式:
因此,大括号似乎存在/存在问题。我试图将其复制到+{{path}}+
自定义的 http-request.snippet 中。没有成功。我也尝试删除该nowrap
选项,但同样,在路径中显示的值是变量名的插入。有人可以告诉我这里可能是什么问题吗?我希望我能提供足够的细节。