Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Schema(example="1234", type="string") interpreted as integer #4820

Open
EAlf91 opened this issue Jan 9, 2025 · 0 comments
Open

@Schema(example="1234", type="string") interpreted as integer #4820

EAlf91 opened this issue Jan 9, 2025 · 0 comments

Comments

@EAlf91
Copy link

EAlf91 commented Jan 9, 2025

Background
After upgrading swagger to 3.1 we face the issue that our schema annotations which have numbers in their examples gets interpreted as integers even though the type is a string.

Example

 record TestDto (@Schema(example = "notANumber") String name, int age) {} //works perfectly fine
 record TestDtoClone (@Schema(example = "1234", type = "string") String name, int age) {} //interpreted as integer even with type="string"

I created a small demo project with a basic test:
https://github.com/EAlf91/swagger-issue/blob/main/src/test/java/org/example/MainTest.java

Expected Behaviour
String examples are correctly interpreted as string when typing is provided

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

No branches or pull requests

1 participant