You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to issue #2367, we propose that int64-strategy option be used to switch output. type: integer is often treated as number type in JavaScript, but number type is not as precise as int64; so this requires a way to represent these values accurately.
I would recommend using @encode for this Playground example. The problem with having an emitter option for this is that now openapi3 doesn't produce the same over the wire format as another emitter
I implemented exactly that switch in the JSON Schema emitter, but I have come to regret it. It's important that you can read a spec and understand that spec's representation across myriad wire formats. When you have compiler flags that alter wire shapes, it breaks that reasoning, because it might be either depending on how the spec consumer decides to compile it. A consequence of that is what Tim mentions, where the openapi3 emit and some other emit (say, REST client emitter) won't agree on a wire shape. In general, it's a recipe for interop bugs within the TypeSpec ecosystem, something we want to avoid if possible.
+1 for using @encode, let us know if that works for you!
Clear and concise description of the problem
I defined an
int64
field in .tsp file and output openapi.yaml, which outputstype: integer
in the corresponding field.In other tools,
int64
fields may be output astype: string
. For example: https://github.com/grpc-ecosystem/grpc-gateway/blob/cfeed71cd584c65b297d53b02143cd9012b13070/protoc-gen-openapiv2/internal/genopenapi/template.go#L71-L74Similar to issue #2367, we propose that
int64-strategy
option be used to switch output.type: integer
is often treated asnumber
type in JavaScript, butnumber
type is not as precise asint64
; so this requires a way to represent these values accurately.Checklist
The text was updated successfully, but these errors were encountered: