spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 734 forks source link

Documenting path parameters does not work with MockMvcTester's fluent API #939

Closed wilkinsona closed 2 weeks ago

wilkinsona commented 3 weeks ago

It works if you use MockMvcTester.perform(RequestBuilder) and RestDocumentationRequestBuilders but this loses much of the benefit of MockMvcTester as you then can't use its fluent API to build the request.

https://github.com/spring-projects/spring-framework/issues/33509 will make the URI template, if any, available from MockHttpServletRequest. REST Docs should use it with Framework 6.2. This will allow the fluent MockMvcTester API to be used to build the request and also remove the need for RestDocumentationRequestBuilders when using Framework 6.2.

eiswind commented 6 days ago

@wilkinsona is there an artifact available that I can use to crosscheck my tests? It doesn't seem to come with 3.0.1.

wilkinsona commented 5 days ago

That's to be expected as 3.0.1 was released in November 2023. Please try with 3.0.2-SNAPSHOT that's available from https://repo.spring.io/snapshot.

eiswind commented 5 days ago

Thx. Works like a charm.

wilkinsona commented 3 days ago

That's good to hear. Thanks for trying the snapshot.