Skip to content

[online] Replace springfox with springdoc - #25818

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
ChihweiLHBird:chore/online-springdoc
Nov 29, 2026
Merged

wing328 merged 1 commit into
OpenAPITools:masterfrom
ChihweiLHBird:chore/online-springdoc

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Replace springfox 3.0.0 with springdoc-openapi 1.8.0 in openapi-generator-online.

springfox is unmaintained (last release July 2020) and only works on Spring Boot 2.6+ with the ant-path-matcher workaround added in #25731. springdoc 1.8.0 is springdoc's Spring Boot 2 line.

Changes

  • The springfox Docket becomes an OpenAPI bean, and the Swagger 1 annotations become OpenAPI 3 ones.
  • The ant-path-matcher workaround and ParameterAllowableValuesPlugin (which had no visible effect) are removed.
  • GENERATOR_HOST becomes the server URL, without trailing slashes.
  • New test for /api-docs.

What changes for users

  • /api-docs is OpenAPI 3.0.1 instead of Swagger 2.0, with the same operations and models.
  • springfox's /swagger-resources endpoints are gone, and URLs with a doubled slash return 404.
  • -Dspringfox.documentation.swagger.v2.host no longer applies; use GENERATOR_HOST.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Replaces springfox with springdoc-openapi in openapi-generator-online so /api-docs now serves an OpenAPI 3.0.1 document instead of Swagger 2.0, with the same seven operations, tags, models, and alphabetical path order.

User-facing changes

  • springfox's /swagger-resources endpoints are gone, and URLs with a doubled slash return 404.
  • -Dspringfox.documentation.swagger.v2.host no longer applies; use GENERATOR_HOST.

Implementation notes

  • Swagger 1 annotations are replaced with OpenAPI 3 annotations, including documenting the free-form spec field as an object.
  • The ant-path-matcher workaround and the ParameterAllowableValuesPlugin are removed.
  • GENERATOR_HOST becomes the server URL, without trailing slashes; unparseable values are logged and ignored.
  • Without GENERATOR_HOST, the server URL from the request drops an http scheme.
  • springdoc's swagger-core is excluded so the generator keeps the version its swagger-parser needs.
  • Added a test for /api-docs to verify the API description and server URL handling.

Written for commit 6459412. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

springfox 3.0.0 is no longer maintained and does not work with the path
matcher that Spring Boot uses by default since 2.6. Replace it with
springdoc-openapi 1.8.0, the line for Spring Boot 2.

- /api-docs is now an OpenAPI 3.0 document instead of Swagger 2.0, with
  the same seven operations, operation ids, tags and models, and the
  paths in the same alphabetical order.
- The Docket configuration becomes an OpenAPI bean. GENERATOR_HOST still
  sets the public address; it is now the server URL of the document,
  without trailing slashes. A value that is neither a URL with a host
  nor a path is logged and ignored.
- Without GENERATOR_HOST, the server URL derived from the request leaves
  out an http scheme, as the springfox document left out the scheme, so
  behind a proxy that terminates TLS clients use the scheme of the page.
- Swagger 1 annotations become their OpenAPI 3 equivalents.
- ParameterAllowableValuesPlugin, a springfox plugin that had no visible
  effect on the generated document, is removed.
- The spring.mvc.pathmatch.matching-strategy workaround is removed.
- springdoc's own swagger-core is excluded so that the generator keeps
  the version its swagger-parser needs.
- A test checks that /api-docs describes the API.
@wing328 wing328 added this to the 7.29.0 milestone Nov 29, 2026
@wing328
wing328 merged commit 33f5660 into OpenAPITools:master Nov 29, 2026
16 checks passed
@ChihweiLHBird
ChihweiLHBird deleted the chore/online-springdoc branch November 29, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants