1

我正在记录我的 api 的路径参数。但它显示了一些自动生成的表名。我正在尝试从路径参数中删除表名。我没有成功。

请帮帮我。

示例图像

4

3 回答 3

2

如果您只想删除表格标题的“表格2”部分,您可以尝试添加标题为空的标题块。例如:

[caption=]
./v1/residences/{id}
include::{snippets}/index/request-parameters.adoc[]
于 2016-03-30T11:03:42.110 回答
2

最好的方法是结合@jmformenti 和@alek 的答案:

  1. path-parameters.snippet在里面创建一个文件src/test/resources/org/springframework/restdocs/templates/asciidoctor/
  2. 使用此模板内容:
[caption=]
.{{path}}
|===
|Parameter|Description

{{#parameters}}
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|{{#tableCellContent}}{{description}}{{/tableCellContent}}

{{/parameters}}
|===

现在,所有生成path-parameters.adoc的文件都将具有正确的内容,您不需要像 Alek 的回答那样为每个包含添加它。

于 2020-03-17T13:58:19.570 回答
1

您必须自定义路径参数片段:

  1. 在您的项目src/test/resources/org/springframework/restdocs/templates/asciidoctor/path-parameters.snippet中添加新的代码片段模板
  2. 模板内容:
+{{路径}}+
|===
|参数|说明

{{#参数}}
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|{{#tableCellContent}}{{description}}{{/tableCellContent}}

{{/参数}}
|===
于 2020-02-09T20:44:49.220 回答