Closed hantsy closed 6 years ago
Did you try it with the reactive stack. I haven't - but from what I read in the spring-restdocs docu I had the impression that it should work.
Let me know if you tried.
I have not tried this(restdocs-raml ) in my webflux sample, so I am not sure if it works in webflux,via WebTestClient.
I have tried restdocs for WebTestClient, but the APIs for WebTestClient are different from MockMVC and RestAssured.
The infrastructure is slightly different. But generally we just add a snippet - and that should stay the same.
But nevertheless there seems to be a change in spring-restdocs 2 that is binary incompatible with spring.restdocs 1.
They changed RestDocumentationContext
from a class to an interface and this results in this exception when trying out restdocs-raml with WebTestClient
:
java.lang.IncompatibleClassChangeError: Found interface org.springframework.restdocs.RestDocumentationContext, but class was expected
So there is an issue not sure how you would solve this and how to achieve to release a version that is compatible with spring-restdocs 1 and 2.
@mduesterhoeft I do not think spring-restdocs 1.x supports Webflux. So I think restdocs-saml could have to start a new restdocs2 branch for the compatibility for spring-restdocs 2.x.
I am still hoping that I can get it to work for both versions. I am already on it.
@hantsy I think I got it to work. I decided to go for reflection instead of having to maintain different versions and branches.
I also forked the spring-restdocs sample using WebTestClient
and adopted it to use restdocs-raml
so I could verify it is also working with spring-restdocs 2.
See https://github.com/mduesterhoeft/spring-restdocs/tree/master/samples/web-test-client
I also documented the compatibility - https://github.com/mduesterhoeft/spring-restdocs/tree/master/samples/web-test-client
@mduesterhoeft Thanks. I will try it soon.
It seems this project only supports traditional Servlet stack, is any plan to support Reactive stack introduced Spring 5, as I know Spring RestDocs 2 has added the support of Reactive now.