Skip to content

Drop swagger-core's transitive dependencies from the servlet module - #250

Open
jampukka wants to merge 1 commit into
nlsfi:mainfrom
jampukka:drop-swagger-core
Open

jampukka wants to merge 1 commit into
nlsfi:mainfrom
jampukka:drop-swagger-core

Conversation

@jampukka

@jampukka jampukka commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

We updated to Jackson 3 but swagger-core still pulls Jackson 2 jars into the WAR. The only thing we depend on from swagger-core are the Jackson mixins. Exclude the transitive dependencies of swagger-core: hakunapi-core already brings in swagger-models, and jackson-annotations (2.x, which Jackson 3 still uses) comes along with Jackson 3 databind.

  • swagger-core Jackson Mixins
    • OpenAPIMessageBodyWriter uses 11 Jackson mixins from io.swagger.v3.core.jackson.mixin to serialize swagger-models POJOs beautifully (x-* extension flattening, hiding internal and OpenAPI 3.1-only getters)
    • The mixins need only com.fasterxml.jackson.annotation (shared by Jackson 3) and swagger-models. Their three Jackson 2 @JsonSerialize annotations are already ignored by Jackson 3; with databind 2 excluded the JDK drops them
      silently.
  • swagger-core with <exclusion>*:*</exclusion>
    • Keeps the mixins, and keeps them in lockstep with swagger-models on upgrade (no copied Apache 2.0 code to maintain).
    • Note: the rest of the jar (~115 classes) would fail with NoClassDefFoundError if ever used, but nothing uses it.
  • Added GoldenDocumentTest
    • Byte-exact /api, /collections/{id}/schema and /queryables, recorded before the pom change and unchanged after. Guards against a later unnoticed swagger-models getter leaking into /api.

Behaviour change:

  • Jackson 2 (jackson-databind, jackson-core, jackson-dataformat-yaml, jackson-datatype-jsr310), snakeyaml, swagger-annotations, jakarta.xml.bind-api 2.x and jakarta.activation-api 1.x no longer arrive via hakunapi-simple-servlet-jakarta.
    • If your custom application relied on them existing declare them yourself as your dependencies

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