fix: render Console Swagger Request Body schemas - #771
Open
Tfh-Yqf wants to merge 1 commit into
Open
Conversation
Pin swagger-ui 5.18.2 (and exclude springdoc's 5.10.3 webjar), normalize wildcard requestBody media types to application/json, and add regression tests so all-in-one Swagger UI shows body fields again. Fixes higress-group/higress#3207 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ⅰ. Describe what this PR did
When Console Swagger UI is enabled (all-in-one / helm
swagger.enabled), Request Body panels stayed empty because:springdoc-openapi-ui1.8.0 transitively ships swagger-ui 5.10.3, which cannot render requestBody schemas (fixed upstream in swagger-ui 5.11.10).consumes, so springdoc emits only a*/*media type; Swagger UI then has nothing concrete to paint.This PR:
springdoc.default-consumes/produces-media-type=application/jsonOpenApiRequestBodyCustomizerto copy wildcard requestBody schemas ontoapplication/jsonⅡ. Does this pull request fix one issue?
Fixes higress-group/higress#3207
Ⅲ. Why don't you add test cases (unit test/integration test)?
Added:
SwaggerUiWebjarVersionTest— classpath / locator must serve swagger-ui >= 5.11.10OpenApiRequestBodySchemaTest— representative@RequestBodyDTOs must resolve to non-empty schemasOpenApiRequestBodyCustomizerTest— wildcard / empty / already-json edge casesmvn -pl console -am test: 20 tests, 0 failures.Ⅳ. Describe how to verify it
SPRINGDOC_API_DOCS_ENABLED=true SPRINGDOC_SWAGGER_UI_ENABLED=true/swagger-ui/index.htmlPOST /v1/routes— Request Body should list fields (name,path,services, ...)mvn -pl console -am test -Dfrontend.skip=trueⅤ. Special notes for reviews
Related earlier fix: higress-console#654 (swagger-ui 5.11.10). This PR hardens the override (explicit dependency + exclusion), bumps to 5.18.2, and closes the still-open higress#3207 with schema/media-type coverage.