-
-
Notifications
You must be signed in to change notification settings - Fork 554
Description
Describe the bug
With the default Ant path matcher, springdoc-openapi correctly scans my @RestController-annotated classes and generates documentation for my endpoints. However, if I configure Spring to use the new PathPatternParser (with the fix for #965), all my endpoints are missing from the UI and from the generated JSON and YAML API documents.
To Reproduce
- Spring Boot 2.4.1 with WebMVC
- springdoc-openapi 1.5.2 with the patch for Compatibility with new PathMatcher #965 applied
- The
kotlin,security, anduimodules of springdoc-openapi
In an app with WebMVC controllers, add a configuration class that enables PathPatternParser, like so:
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setPatternParser(new PathPatternParser());
}
}Now fetch /v3/api-docs from the server to fetch the API definition. The paths section will be completely empty, though other parts of the document (security schemas, servers, etc.) will be correct.
Hit one of the actual endpoints and confirm it still works (that is, the configuration isn't just breaking the MVC configuration entirely).
Comment out the configurer.setPatternParser line, rebuild/restart, and fetch /v3/api-docs again. The paths section will include all the endpoints.
Expected behavior
The API definition JSON is the same with or without the configuration class.