-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Allow serDes for types other than string #654
Comments
Updated the description and title with more generic (and I hope compelling) examples. |
Note that currently, the output of any custom |
Hello @rattrayalex I'm looking at this enhancement. For example, I don't think BigInt is universal enough. Am I right ? |
Hi @pilerou, Thanks for looking into this! My hunch is that it should be fully generic. For example, there may even be a type: object that gets serialized into a class instantiation or something. I'm not quite sure what you mean about BigInt but I could also imagine someone using a custom datatype for those too (like a big decimal datatype for example). I hope this helps? |
Is your feature request related to a problem? Please describe.
Right now,
serDes
only works for fields that aretype: 'string'
, but I have found a few cases where I would like to perform some serialization or deserialization on types other than strings.One example is turning
Date
tonumber
; I wanttype: 'number'
in the spec (the API has seconds since epoch), but on the backend I wantDate
types.However, this doesn't seem to work –
serDes
only works whentype: 'string'
, even though you can declare custom formats fortype: 'number'
.Another example is booleans in query strings; I would like to be able to transform all
type: 'boolean'
objects into an actual boolean when they appear as strings, like so:Describe the solution you'd like
I would like
serDes
to allow any field with aformat
to be serialized and deserialized with a custom function, not just strings.Describe alternatives you've considered
The only workarounds I can think of right now is to use
type: 'string'
everywhere, or to manually convert them in all my function calls, neither of which is palatable.The text was updated successfully, but these errors were encountered: