[online] Replace springfox with springdoc
Merged
CH
1d ago+199+199+012345678901234567890123456789-156-156-012345678901234567890123456789
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
Docketbecomes anOpenAPIbean, and the Swagger 1 annotations become OpenAPI 3 ones. - The
ant-path-matcherworkaround andParameterAllowableValuesPlugin(which had no visible effect) are removed. GENERATOR_HOSTbecomes the server URL, without trailing slashes.- New test for
/api-docs.
What changes for users
/api-docsis OpenAPI 3.0.1 instead of Swagger 2.0, with the same operations and models.- springfox's
/swagger-resourcesendpoints are gone, and URLs with a doubled slash return 404. -Dspringfox.documentation.swagger.v2.hostno longer applies; useGENERATOR_HOST.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
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-resourcesendpoints are gone, and URLs with a doubled slash return 404. -Dspringfox.documentation.swagger.v2.hostno longer applies; useGENERATOR_HOST.
Implementation notes
- Swagger 1 annotations are replaced with OpenAPI 3 annotations, including documenting the free-form
specfield as an object. - The
ant-path-matcherworkaround and theParameterAllowableValuesPluginare removed. GENERATOR_HOSTbecomes the server URL, without trailing slashes; unparseable values are logged and ignored.- Without
GENERATOR_HOST, the server URL from the request drops anhttpscheme. springdoc'sswagger-coreis excluded so the generator keeps the version itsswagger-parserneeds.- Added a test for
/api-docsto verify the API description and server URL handling.