Skip to content

Comments

fix: treat number example as number and not string#5062

Open
Mattias-Sehlstedt wants to merge 1 commit intoswagger-api:masterfrom
Mattias-Sehlstedt:treat-number-example-as-number-and-not-string
Open

fix: treat number example as number and not string#5062
Mattias-Sehlstedt wants to merge 1 commit intoswagger-api:masterfrom
Mattias-Sehlstedt:treat-number-example-as-number-and-not-string

Conversation

@Mattias-Sehlstedt
Copy link
Contributor

@Mattias-Sehlstedt Mattias-Sehlstedt commented Feb 23, 2026

Pull Request

Thank you for contributing to swagger-core!

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


Description

Restores part of the schema example construction that was lost with PR #5046 and the change of this line.

The behavior that has been reintroduced is that an example for a number schema (number/integer) retains the old behavior of using the JsonNode as the example value, rather than using its String-representation. This will in turn lead to the example being a number in the specification.

This is of importance since the example value should align with the type defined in the schema.

Fixes: #5061

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

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.

[Bug]: Number example treated as a string when generating swagger file.

1 participant