Spring REST Docs takes a test-driven approach to documenting RESTful APIs. It uses Spring MVC Test, Spring WebFlux’s WebTestClient or REST Assured to generate accurate, tested documentation snippets that can then be included in documentation written in Asciidoctor or Markdown. Use this tag for questions about Spring REST Docs and its interaction with one of the test frameworks and markup languages.
Questions tagged [spring-restdocs]
274 questions
0
votes
1 answer
How to remove port number completely from example curl
I am documenting a web API and I need the curl and httpie examples to be a valid calls to our endpoints. The problem is that the example curl snippet includes a port number and I dont see any way to get rid of it. I see how to set the port number,…

the_coding_cowboy
- 23
- 5
0
votes
1 answer
Duplicate Request Parameters being recorded in the snippet
As the title suggests I have a Controller endpoint I'm trying to document. The endpoint can take 2 parameters both are optional. When it goes to generate the code the parameter is duplicated.
Controller
@RequestMapping("/bitbucket/project")
…

ndrone
- 3,524
- 2
- 23
- 37
0
votes
1 answer
Spring REST Docs - WS02 integration
I have been looking at Spring REST doc and have been suitably impressed. However organisational constraints require that all developed REST API's must be registered in the WS02 registry.
I had a brief look at the WS02 registry and it allows for a…
0
votes
1 answer
Spring RestDoc 1.1:MockMvcRestDocumentation.documentationConfiguration not working with JUnitRestDocumentation
I have configured as follows my rest docs with Junit4 ,with spring boot 1.4
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@ActiveProfiles(SPRING_PROFILE_ACTIVE_TEST)
public…

MasterCode
- 975
- 5
- 21
- 44
0
votes
1 answer
Rest docs with Spring data Rest for Spring-data-couchbase
Hi guys having a very rough day trying to figure out Restdocs with Spring Data Couchbase and Spring Data Rest.
Currently I have a Spring-Data-Couchbase Project leveraging spring-Data-Rest-Hal-Browser. This is awesome because it basically overs a…

Matthew Fontana
- 3,790
- 2
- 30
- 50
0
votes
1 answer
Spring Restdocs source gradle build fails during test
I have downloaded a copy of the 1.1.0-RELEASE tagged source code for Spring RESTdocs, but "gradlew build" is failing during the test phase. 273 of 502 tests are failing with variations on this…

Julie C
- 1
- 1
0
votes
1 answer
How do I make sure my documentation is up to date with Spring Rest Docs?
I really like the concept of using failed tests to ensure the documentation is up to date. But I don't know how to make it work for nested json. The way Spring REST Docs handles hierarchical payload seems to defeat the purpose:
When documenting…
0
votes
0 answers
preprocessResponse(prettyPrint()) can NOT deal with huge JSON data response
I am using preprocessResponse to format JSON response. I works fine with small JSON data.
small JSON data
On the other hand, problem happens when i work with huge JSON data response. It fails in build process with error below
PayloadHandling…

Howard Ho
- 51
- 1
- 5
0
votes
0 answers
"ERROR: 'Premature end of file.' " happens when generating snippets using Spring Restdocs
I am using Spring Restdocs for documentation. Here's my code:
RestDocumentationResultHandler document = document("{class-name}/{method-name}",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()));
String authHead =…

Howard Ho
- 51
- 1
- 5
0
votes
1 answer
How to switch locale in Spring REST docs?
I have a @RestController where one of the arguments of a controller method is Locale
@RequestMapping("/{id}")
public Survey getSurvey( @PathVariable("id") SurveyId surveyId,
Locale locale ) { ... }
I have a working…

Wim Deblauwe
- 25,113
- 20
- 133
- 211
0
votes
1 answer
Build swagger2 specs via spring-rest-docs
I like the TDD approach to documenting your restful api with spring-rest-docs. However, I love "API Playground" feature enabled by swagger specification. I wish there was a way to get best of both worlds.
Is there a way to build swagger2 specs from…

Ketan Maydeo
- 3
- 2
0
votes
1 answer
spring-restdocs 1.1.0.BUILD-SNAPSHOT maven is not generating the adoc files
I followed the testng sample of spring-restdocs 1.1.0.BUILD-SNAPSHOT. I am able to generate the adoc file through gradle. But when I am using the maven its not generating the doc files.
Mmy pom.xml has the following details:
…

Prasanta Mohanty
- 1
- 1
0
votes
2 answers
JsonParseException: Invalid UTF-8 middle byte 0x20 with MockMVC and Maven
EDIT: If I remove the spring-restdoc code, the test passes with maven.
I'm trying to write an integration test with MockMVC in a Spring Boot web app.
I have only one test at the moment (steps and code below) that pass if I run it in the IDE but…

Francesco Papagno
- 617
- 10
- 29
0
votes
1 answer
Spring REST Docs getting started
Following the REST Docs getting started tutorial I unfortunately receive the following error:
java.lang.IllegalArgumentException: WebApplicationContext is required
at org.springframework.util.Assert.notNull(Assert.java:115)
at…

Georg Heiler
- 16,916
- 36
- 162
- 292
0
votes
0 answers
Can I generate an API documentation using spring-restdoc?
I'm using spring-restdoc to document my restful services. I'm now moving on and also want to expose the events I publish. What would be a proper way to incorporate these in the document?
I've come up with writing a class similar to RestDocument,…

Roald Bankras
- 564
- 4
- 14