Document how to use Spring REST Docs with the WebTestClient with Spring-Boot
See original GitHub issueWhere in the documentation I could present a example of using it with WebTestClient + Spring-Boot. e.g.
@WebFluxTest
@AutoConfigureRestDocs
class ControllerTests {
private WebTestClient webClient;
@BeforeEach
void setUp(
@Autowired ApplicationContext context,
@Autowired WebTestClientRestDocumentationConfigurer configurer) {
webClient = WebTestClient
.bindToApplicationContext(context)
.configureClient()
.filter(configurer)
.entityExchangeResultConsumer(document("{class-name}/{method-name}"))
.build();
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Spring REST Docs
Spring REST Docs helps you to document RESTful services. It combines hand-written documentation written with Asciidoctor and auto-generated snippets produced ...
Read more >Introduction to Spring REST Docs - Baeldung
This article introduces Spring REST Docs, a test-driven mechanism to generate documentation for RESTful services that is both accurate and ...
Read more >Documenting Spring Boot Restful Services (Spring ... - LinkedIn
Spring REST docs uses your tests to generate documentation. What tests? In our case, unit tests for your controllers using Spring MockMvc ...
Read more >Spring REST Docs - Test driven documentation of REST API
How to document your Spring Boot REST APIs using Swagger with SpringFox? It is a powerful tool, which can be useful especially when...
Read more >Document your API with Spring REST Docs - Igorski
Currently REST Docs can be used in tests that use Spring MVC's test framework, Spring WebFlux's WebTestClient or REST Assured 3.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I wouldn’t mind at all. Thanks for the offer.
While the issue I just opened is targeted at 2.4.x, a PR based off main would still be useful. If you do that this is where the new documentation should be added. Alternatively, if you’d prefer to base your PR off the 2.4.x branch, the new documentation should go here.
@wilkinsona That’s a very good idea. It’s could help others like me! And thank you so much for your example above! That’s amazing!
If you want I can create a PR for your example above. Would you mind?