spring-restdocs How to remove the table name from the path parameters

Related searches

I am documenting the path parameters for my api. But it displays some auto generated table name. I am trying to remove the table name from the path parameter . I didn't succeed.

Please help me out.

Sample Image

If you want to remove only "Table 2" part of table caption, you can try to add caption block with empty title. For example:

[caption=]
./v1/residences/{id}
include::{snippets}/index/request-parameters.adoc[]

Spring REST Docs, I am documenting the path parameters for my api. But it displays some auto generated table name.I am trying to remove the table name from� The result is a snippet named path-parameters.adoc that contains a table describing the path parameters that are supported by the resource. When documenting path parameters, the test will fail if an undocumented path parameter is used in the request.

You have to customize the path-parameters snippet:

  1. Add new snippet template in your project src/test/resources/org/springframework/restdocs/templates/asciidoctor/path-parameters.snippet
  2. Template content:
+{{path}}+
|===
|Parameter|Description

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

{{/parameters}}
|===

RequestDocumentation.pathParameters ignores , Request Parameters; Path Parameters; Request Parts; Request Part Payloads Pretty Printing; Masking Links; Removing Headers; Replacing Spring REST Docs uses snippets produced by tests written with The result is a snippet named links.adoc that contains a table describing the resource's links. spring-restdocs How to remove the table name from the path parameters. You have to customize the path-parameters snippet: Add new snippet template in your project

The best way is to combine the answers of @jmformenti and @alek:

  1. Create a file path-parameters.snippet inside src/test/resources/org/springframework/restdocs/templates/asciidoctor/
  2. Use this template content:
[caption=]
.{{path}}
|===
|Parameter|Description

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

{{/parameters}}
|===

Now, all generated path-parameters.adoc files will have the proper contents and you don't need to add it for every include like in the answer of Alek.

Spring Auto REST Docs, Request parameters; Path parameters; Request parts; Request part payloads Pretty printing; Masking links; Removing headers; Replacing patterns To this end, Spring REST Docs uses Asciidoctor by default. The result is a snippet named links.adoc that contains a table describing the resource's links� 1: Add a dependency on spring-restdocs-mockmvc in the test scope. If you want to use REST Assured rather than MockMvc, add a dependency on spring-restdocs-restassured and com.jayway.restassured:restassured (REST Assured 2) or io.rest-assured:rest-assured (REST Assured 3) instead.

pathParameters ignores RestDocumentationMockMvcConfigurer # The path parameters snippet uses the URL template from the request as the title of the table. wilkinsona removed the status: waiting-for-feedback label on Nov 26, I am using RestTemplate together with Spring Rest Docs in my test� Configure Spring REST Docs to produce a snippet describing the request’s path parameters. Uses the static pathParameters method on org.springframework.restdocs.request.RequestDocumentation . 2

You still get the same nice documentation as with Spring REST Docs itself. gradlew asciidoctor if asciidoctor is the name of the Gradle task in your setup. You might have to remove dependsOn test depending on your setup to run it < table>. Path parameters snippet automatically lists parameters in the� Configure Spring REST Docs to produce a snippet describing the request’s path parameters. Uses the static pathParameters method on org.springframework.restdocs.request.RequestDocumentation . 3

Writing high-quality documentation is difficult. One way to ease that difficulty is to use tools that are well-suited to the job. To this end, Spring REST Docs uses Asciidoctor by default. Asciidoctor processes plain text and produces HTML, styled and layed out to suit your needs. If you prefer, Spring REST Docs can also be configured to use

Comments
  • You want to remove "Table 2" and keep "/v1/residences/{id}"?