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
Hi,
Apologies if I have missed this mentioned somewhere, but is there a way to annotate a typescript number as being an integer, so it gets transformed to Type.Integer(...) in typebox code and {"type": "integer"} in JSONSchema?
I was imagining I could do something like the following, but was unable to find if such an annotation exists:
Or even better if there was a predefined Integer type that could be imported, which aliased to number, but which typebox-codegen knows to transform it as an integer type.
Also, is there a reference somewhere for the JSDoc annotations supported? It seems like they are just passed in raw as options to the typebox type constructors. If this is the case, it seems what I want would not be currently possible because it appears Type.Number has no such option to constrain it to be an integer (in regular typebox you use Type.Integer instead as a separate type).
Thanks for any responses, and to the author for a great library.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Apologies if I have missed this mentioned somewhere, but is there a way to annotate a typescript number as being an integer, so it gets transformed to
Type.Integer(...)
in typebox code and{"type": "integer"}
in JSONSchema?I was imagining I could do something like the following, but was unable to find if such an annotation exists:
Or even better if there was a predefined
Integer
type that could be imported, which aliased tonumber
, but whichtypebox-codegen
knows to transform it as an integer type.Also, is there a reference somewhere for the JSDoc annotations supported? It seems like they are just passed in raw as options to the typebox type constructors. If this is the case, it seems what I want would not be currently possible because it appears
Type.Number
has no such option to constrain it to be an integer (in regular typebox you useType.Integer
instead as a separate type).Thanks for any responses, and to the author for a great library.
Beta Was this translation helpful? Give feedback.
All reactions