Skip to content

Enabling PathPatternParser causes endpoints to be ignored #1034

Closed
@sgrimm

Description

@sgrimm

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions