-
-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Springdoc does not work with Spring's "capture the rest" PathPattern syntax #2383
Comments
Please provide
|
@bnasslahsen Many thanks in advance! I have attached a working demo here: The Controller class is like:
Actual Result: Expected Result: To be clear - from the above usage with a real browser URL, we see this is working great in my controller. The problem is that springdoc can not be used to demonstrate a functioning API. This is using the "capture the rest" syntax to capture an entire path (all segments) as documented here: The spring team maintains unit test supporting this syntax here Let me know if there is anything else I can do to help! |
This is not supported by the OpenApi spec for now: OAI/OpenAPI-Specification#892 |
@bnasslahsen - thanks for the link. From reading that, I understand the decision. Thanks for consideration. |
Describe the bug
Also on stackoverflow.com here:
https://stackoverflow.com/questions/77129312/springdoc-2-2-0-latest-does-not-work-with-springs-capture-the-rest-pathpatt
Since 5.0, Spring supports a path parser known as "PathPattern", it's recommended for many reasons
https://spring.io/blog/2020/06/30/url-matching-with-pathpattern-in-spring-mvc
There is a "capture the rest" syntax to capture an entire path (all segments) as documented here:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/pattern/PathPattern.html
We can see how this is used/tested here:
https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java
The following Spring Boot MVC snippet shows the situation. Unfortunately, I am required to support this endpoint as defined (for legacy reasons), so changing the "protocol" is not an option. My goal is to enable OpenDoc/Swagger.
Here are my observations:
Spring Doc Failing / App Working:
Spring Doc Working / App Failing:
Summary:
It seems that SpringDoc is somehow stumbling on the so-called "capture the rest" syntax, and building the URL from the exact syntax instead of building the URL from what was captured by the "capture the rest" syntax.
I've tried many variations of the syntax options, and likewise tried reviewing springdoc configuration options but so far I have not found a solution that both allows my application to work, and also be demoed via SpringDoc/Swagger.
The text was updated successfully, but these errors were encountered: