Skip to content

IGDD-3084: auto-detect swagger-ui webjar version instead of hand-pinning it - #95

Open
tmy1313 wants to merge 2 commits into
developfrom
IGDD-3084_swagger_ui_version_sync
Open

IGDD-3084: auto-detect swagger-ui webjar version instead of hand-pinning it#95
tmy1313 wants to merge 2 commits into
developfrom
IGDD-3084_swagger_ui_version_sync

Conversation

@tmy1313

@tmy1313 tmy1313 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the hand-pinned springdoc.swagger-ui.version with a BeanPostProcessor that auto-detects the actual org.webjars:swagger-ui version on the classpath, so the two never drift and the UI stops 404ing after a webjar bump.
  • Follow-up hardening from code review: widens the detection failure catch clause from RuntimeException to Throwable, so an Error (e.g. NoClassDefFoundError if webjars-locator-lite is ever excluded/downgraded) logs a warning and falls back instead of crashing application startup.
  • Removes an unreachable legacy-pin test assertion that could never fail under any implementation; coverage for the real failure modes is unchanged.

Test plan

  • mvn -q -pl . test -Dtest=SwaggerUiVersionConfigTests — 6/6 pass
  • Verified via mvn dependency:tree that webjars-locator-lite:1.1.3 and org.webjars:swagger-ui:5.32.14 are on the classpath as expected
  • Reproduced a NoClassDefFoundError scenario locally (removing the webjars-locator jar) to confirm the widened catch clause prevents a startup crash

🤖 Generated with Claude Code

tmy1313 and others added 2 commits August 27, 2026 11:28
…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>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant