IGDD-3084: auto-detect swagger-ui webjar version instead of hand-pinning it - #95
Open
tmy1313 wants to merge 2 commits into
Open
IGDD-3084: auto-detect swagger-ui webjar version instead of hand-pinning it#95tmy1313 wants to merge 2 commits into
tmy1313 wants to merge 2 commits into
Conversation
…ing it Springdoc reads springdoc.swagger-ui.version from application.yml, but izgw-bom independently bumps org.webjars:swagger-ui on its own nightly schedule, so any hand-pinned value drifts and Swagger UI 404s until someone notices and re-edits the yaml. SwaggerUiVersionConfig detects the actual webjar version on the classpath at startup and overrides Springdoc's SwaggerUiConfigProperties with it, so there is no longer a second value to keep in sync. Mirrors the fix already shipped in izgw-transform under IGDD-2976, moved here so every consumer inherits it automatically instead of each service needing its own copy (this ticket is exactly the second-consumer case that fix's own design doc anticipated).
Error subclasses (e.g. NoClassDefFoundError if webjars-locator-lite is excluded/downgraded) were not caught, so a detection failure could crash application startup instead of falling back gracefully. Also removes an unreachable legacy-pin test assertion that could never fail under any implementation; coverage for the real failure modes is unchanged (SPRINGDOC_BUNDLED_DEFAULT check + alignerOverridesPreExistingConfiguredVersion). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
4 tasks
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.



Summary
springdoc.swagger-ui.versionwith aBeanPostProcessorthat auto-detects the actualorg.webjars:swagger-uiversion on the classpath, so the two never drift and the UI stops 404ing after a webjar bump.RuntimeExceptiontoThrowable, so anError(e.g.NoClassDefFoundErrorifwebjars-locator-liteis ever excluded/downgraded) logs a warning and falls back instead of crashing application startup.Test plan
mvn -q -pl . test -Dtest=SwaggerUiVersionConfigTests— 6/6 passmvn dependency:treethatwebjars-locator-lite:1.1.3andorg.webjars:swagger-ui:5.32.14are on the classpath as expectedNoClassDefFoundErrorscenario locally (removing the webjars-locator jar) to confirm the widened catch clause prevents a startup crash🤖 Generated with Claude Code