-
-
Couldn't load subscription status.
- Fork 551
Description
Describe the bug
When configuring multiple API groups in Springdoc OpenAPI (2.8.13), the API endpoints from one group are being merged into another group when the global property springdoc.packages-to-scan is defined.
For example:
When accessing /api-docs/external-api-v3, the OpenAPI docs also includes endpoints from external-api-v4.
When accessing /api-docs/external-api-v4, it also includes endpoints from external-api-v3.
This happens only when springdoc.packages-to-scan is set.
If it is left empty, the groups work correctly, but then /api-docs includes all packages (including internal ones), which is not desired.
To Reproduce
Configuration:
springdoc.packages-to-scan=com.my.server.v3.external.api, com.my.server.v4.external.api
springdoc.group-configs[0].group=external-api-v3
springdoc.group-configs[0].display-name=External API v3
springdoc.group-configs[0].packages-to-scan=com.my.server.v3.external.api
springdoc.group-configs[1].group=external-api-v4
springdoc.group-configs[1].display-name=External API v4
springdoc.group-configs[1].packages-to-scan=com.my.server.v4.external.api
Project package structure:
com.my.server.v3.external.api
com.my.server.v4.external.api
com.my.server.v3.internal.api
com.my.server.v4.internal.api
Version information
org.springdoc:springdoc-openapi-starter-webmvc-ui: 2.8.13
Spring Boot: 3.4.8
Expected behavior
With the above configuration:
/api-docs/external-api-v3 → should only contain endpoints from com.my.server.v3.external.api
/api-docs/external-api-v4 → should only contain endpoints from com.my.server.v4.external.api
/api-docs → should include both v3 and v4 external APIs, but not any internal APIs.
Actual behavior
Both /api-docs/external-api-v3 and /api-docs/external-api-v4 include endpoints from both external API packages when springdoc.packages-to-scan is configured.
Workarounds
Setting springdoc.packages-to-scan= (empty) fixes the group merging,
but causes /api-docs to include all packages, including internal ones.
Using springdoc.packages-to-exclude works temporarily,
but it breaks when new packages are added to the project.