-
Notifications
You must be signed in to change notification settings - Fork 238
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
[OpenAPI] Safeint emits int64 format #2367
Comments
I had never seen “safe int” before in type definitions, but I liked the idea at first look. However, I found this issue when looking to request a “Big Integer” format (a string format). If Therefore,
Edit: Smithy has |
@connorjs I think it would be a mistake to use a hypothetical bigInteger for integers in the safeint range above 2^32-1. I've seen that in practice there are many integers that don't fit in 32 bits but which fit comfortably in 53 bits, and using a We effectively do have |
Thanks for the information @bterlson! Good points. That also clarifies the intent of |
ProposalCurrent behavior is we emit Option 1:
|
The "double-int" format has been approved and merged into the OAI Format Registry. https://spec.openapis.org/registry/format/double-int.html I think the autorest and openapi3 emitters should render the |
Agree on changing openapi3, @johanste what do you think about autorest emitter respecting this format, it will for sure not work with autorest and the linter? |
Oh good point! Maybe just the openapi3 emitter, and leave autorest as is. |
|
new config option: safeint-strategy: "int64" | "double-int" |
fix #2367 Format was added to the schema registry so we are safe to use that now https://spec.openapis.org/registry/format/double-int.html --------- Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
…soft#2933) fix microsoft#2367 Format was added to the schema registry so we are safe to use that now https://spec.openapis.org/registry/format/double-int.html --------- Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
While there may not be an accurate
format
specifier for safeint, I believe the current emit offormat: int64
feels incorrect. The entire point of safeint is an int that fits safely into a double, so the ideal JS emit for this would indeed be a double. But the emitted OpenAPI doesn't indicate this, so a conservative emitter would pick BigInteger (at severe ergonomic cost).I believe we have a few options, any of which would be better IMO:
int53
to the format registry and use that if acceptedint53
double
The text was updated successfully, but these errors were encountered: