Skip to content

refactor: simplify type handling in ModelDeserializer#5227

Open
Mattias-Sehlstedt wants to merge 4 commits into
swagger-api:masterfrom
Mattias-Sehlstedt:refactor-model-deserializer
Open

refactor: simplify type handling in ModelDeserializer#5227
Mattias-Sehlstedt wants to merge 4 commits into
swagger-api:masterfrom
Mattias-Sehlstedt:refactor-model-deserializer

Conversation

@Mattias-Sehlstedt

@Mattias-Sehlstedt Mattias-Sehlstedt commented Jul 6, 2026

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

Simplifies the logic in the ModelDeserializer so that a typed Schema is clearly handled as its own separate scenario with its own processing. Also reduced the surface area against Jackson, so that an upgrade will have a much smaller delta (this change was mainly inspired by this larger-than-necessary delta).

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

@Rymert-Mostert Rymert-Mostert left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Just looking for the "Dismiss my own review" button.
https://github.com/orgs/community/discussions/120006

@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the refactor-model-deserializer branch from af818f2 to 914d3e5 Compare July 8, 2026 15:07
@ewaostrowska ewaostrowska added the backlog label Jul 9, 2026 — with Claude
@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the refactor-model-deserializer branch from 914d3e5 to cd434f6 Compare July 15, 2026 12:02
@ewaostrowska

Copy link
Copy Markdown
Contributor

Hi @Mattias-Sehlstedt!

Thank you for contributing to Swagger Core again and for working to improve the code.

Overall, the refactor looks good, but I found one place where the behavior changes. I’ve pushed tests that illustrate the difference.

Please decide whether $ref should continue using asText() or require a textual node. If strict textual validation is intentional, please document it as a behavioral change

@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the refactor-model-deserializer branch from 170126a to 0c5a5aa Compare July 17, 2026 09:47
@Mattias-Sehlstedt

Copy link
Copy Markdown
Contributor Author

Good spotting. I cannot strongly prove that the changes will not affect someone else's workflow, so it is safest to ensure that the behavior is precisely as before.

I have re-added the TextNode casting so that the entire type-branch will throw if there is a casting issue (same behavior as before since array is the first if-case).

I have also restored how $ref is read (with .asText()) and also added a test to showcase what that results in (.textValue() resulted in null as the String value).

@Mattias-Sehlstedt
Mattias-Sehlstedt force-pushed the refactor-model-deserializer branch from 0c5a5aa to 819ce1a Compare July 20, 2026 15:42
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.

3 participants