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
Where MyObjectType would have a MarshalJSON/UnmarshalJSON that validated that the value was a valid MyObjectType, and produce an error if it was not.
If there's concerns about backwards compatibility, some additional niceties might be to keep the Type field as a string, but add validation to MarshalJSON/UnmarshalJSON to ensure it's a valid value, and error if it was not.
This is something I can probably dedicate a little bit of time into imlpementing, but I'm not sure what approach would be best in the eyes of the maintainer, or if there are other options I hadn't considered that may be desirable.
The text was updated successfully, but these errors were encountered:
Given an input like
this would currently get generated like
It'd be really handy to generate a type for the enum, such as:
Where
MyObjectType
would have aMarshalJSON
/UnmarshalJSON
that validated that the value was a validMyObjectType
, and produce an error if it was not.If there's concerns about backwards compatibility, some additional niceties might be to keep the
Type
field as a string, but add validation toMarshalJSON
/UnmarshalJSON
to ensure it's a valid value, and error if it was not.This is something I can probably dedicate a little bit of time into imlpementing, but I'm not sure what approach would be best in the eyes of the maintainer, or if there are other options I hadn't considered that may be desirable.
The text was updated successfully, but these errors were encountered: