Skip to content

Lock OAS 3.1 type deserializer behavior and drop a dead null check - #2

Draft
jaipilot[bot] wants to merge 1 commit into
jaipilot-campaign/swagger-core-5266-headfrom
jaipilot/pr-1-VizsrfD6wxAR
Draft

Lock OAS 3.1 type deserializer behavior and drop a dead null check#2
jaipilot[bot] wants to merge 1 commit into
jaipilot-campaign/swagger-core-5266-headfrom
jaipilot/pr-1-VizsrfD6wxAR

Conversation

@jaipilot

@jaipilot jaipilot Bot commented Aug 22, 2026

Copy link
Copy Markdown

Companion improvement for the JAIPilot Cloud mirror of swagger-api#5266 (exact head 3ee7d00).

What the original PR does: adds Schema31Mixin.TypeDeserializer, the inverse of the existing TypeSerializer, so an OAS 3.1 'type' property serialized as a scalar string or a string array can be read back into the model's Set types field; wires it via @JsonDeserialize on Schema31Mixin.getTypes() and on GenericOpenApiContext.SortedSchemaMixin31.getTypes() (which reuses the same TypeDeserializer class rather than duplicating it); and adds JsonSchemaTypeRoundTripTest and SortedSchemaMixin31TypeRoundTripTest to prove the round trip.

What this companion adds on top, without changing any observable behavior:

  1. Behavior lock: added one characterization test, typeArrayWithLiteralJsonNullElementSkipsIt, deserializing {"type":["string",null]} to explicitly cover the array branch's handling of a literal JSON null element (distinct from the string type name "null"). Ran it against the untouched PR-head implementation first (passed), matching this workflow's behavior_baseline/behavior_candidate requirement.
  2. Cleanup: removed the unreachable 'n != null' reference-null guard inside TypeDeserializer's array-iteration lambda. JsonNode array iteration never yields an actual Java null reference (a JSON null literal becomes a NullNode instance), which was confirmed with a small standalone Jackson program, so the check was dead defensive clutter; the meaningful n.isNull() check is preserved unchanged.
  3. Performance and modernization: evaluated and found not applicable. The deserializer is a small, non-hot-path operation with no build/runtime version surface in the changed files.

Verification: focused JsonSchemaTypeRoundTripTest and SortedSchemaMixin31TypeRoundTripTest pass identically before and after the edit; the full swagger-core (771 tests) and swagger-integration (3 tests) suites pass clean on the final candidate.

Limitations: performance was not benchmarked because the change is not on a measurable hot path (deterministic, non-looping allocation); no build/dependency file was touched so modernization was out of scope for this PR's changed paths.


Generated by JAIPilot Cloud for #1 from Anthropic session sesn_01HyJAA8Nve7VizsrfD6wxAR.

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.

0 participants