Skip to content

fix: correct sibling logic when reading type from schema annotation#5237

Closed
Mattias-Sehlstedt wants to merge 1 commit into
swagger-api:masterfrom
Mattias-Sehlstedt:correct-sibling-logic-when-reading-type-from-schema-annotation
Closed

fix: correct sibling logic when reading type from schema annotation#5237
Mattias-Sehlstedt wants to merge 1 commit into
swagger-api:masterfrom
Mattias-Sehlstedt:correct-sibling-logic-when-reading-type-from-schema-annotation

Conversation

@Mattias-Sehlstedt

Copy link
Copy Markdown
Contributor

Pull Request

Thank you for contributing to swagger-core!

Please fill out the following information to help us review your PR efficiently.


Description

Introduces an intermediate fix for the issue reported in #5235. It does not solve the sibling handling in its entirety, since it only adjusts the type if types contains a single value (this is aimed to give a fallback for the logic implemented for OAS 3.0. This since type and types are now better isolated from each other, and the resolver expect the user to use the right field for the right OAS version).

For OAS 3.1 it is currently not possible to entirely handle types since it is converted into a single type that is fed into AnnotatedType. For a real scenario the entire type array should be utilized and passed along.

This also comes with the behavior of coercing the string value for the type into a PrimitiveType. This might in turn lead to format or similar being calculated for integer, which might not always be what one expects when using @Schema(types = {"integer"}).

Fixes: #5235

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the correct-sibling-logic-when-reading-type-from-schema-annotation branch from c349630 to 57331d9 Compare July 15, 2026 18:58
@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the correct-sibling-logic-when-reading-type-from-schema-annotation branch from 57331d9 to 46c0d67 Compare July 15, 2026 21:55
@ewaostrowska ewaostrowska added the backlog label Jul 16, 2026 — with Claude
@Mattias-Sehlstedt

Copy link
Copy Markdown
Contributor Author

Closed since this goes further than solving the initial issue and instead also starts to try to implement proper type overriding. That is better left as separate issue since it should be a feat if it is even of interest to implement.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: incorrect sibling logic when reading type from schema annotation

2 participants