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

Generated results for Character Java type are invalid #2124

Closed
dhoffer opened this issue Jan 3, 2025 · 2 comments · Fixed by #2128
Closed

Generated results for Character Java type are invalid #2124

dhoffer opened this issue Jan 3, 2025 · 2 comments · Fixed by #2128
Labels
bug Something isn't working

Comments

@dhoffer
Copy link

dhoffer commented Jan 3, 2025

We are finding that a Java Character field is mapped to OpenAPI via:

"type": "string",
"format": "byte",
"maxLength": 1.0,

We do not think 'byte' is the correct format nor is it documented in the 3.1.0 spec. Also length types should be integers not floating point. Also another reason byte does not make sense is a Character is one char or 2 bytes (or could be more under special cases) in Java.

We think the correct OpenAPI for this would be:

"maxLength": 1,
"minLength": 0,
"type": "string",

Thanks,
-David

@MikeEdgar MikeEdgar added the bug Something isn't working label Jan 4, 2025
@MikeEdgar
Copy link
Member

Maybe format: char [1] would be even better. This implies the length of 1.

"type": "string",
"format": "char"

[1] https://spec.openapis.org/registry/format/char.html

@dhoffer
Copy link
Author

dhoffer commented Jan 5, 2025

Hi @MikeEdgar yes that does seem reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants