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
This is a proposal, and may not be the correct way of doing stuff. My goal is to implement a generic custom converter for string based enums, and I think this would allow that.
Whilst trying to write a generic custom converter for string based Enum types, I find that the current design of JsonCustomConvert will not allow such behavior (to my knowledge).
I was thinking about implementing a design such as:
The current JsonCustomConvert-interface only includes data as a parameter. What I am proposing is adding a second parameter, type, which passes the generic type on.
Interface today:
deserialize(data: any): T;
my proposal:
deserialize(data: any,type: T): T;
This will allow us to access the types value in the converter, allowing for a generic custom enum converter.
Perhaps I am doing something wrong? :)
The text was updated successfully, but these errors were encountered:
I am not sure if it is possible, but you are welcome to make a pull request! I do not know at the moment when I will be investing time in development again, but I will keep this issue open for this purpose.
This is a proposal, and may not be the correct way of doing stuff. My goal is to implement a generic custom converter for string based enums, and I think this would allow that.
Whilst trying to write a generic custom converter for string based Enum types, I find that the current design of
JsonCustomConvert
will not allow such behavior (to my knowledge).I was thinking about implementing a design such as:
The current JsonCustomConvert-interface only includes data as a parameter. What I am proposing is adding a second parameter, type, which passes the generic type on.
Interface today:
my proposal:
This will allow us to access the types value in the converter, allowing for a generic custom enum converter.
Perhaps I am doing something wrong? :)
The text was updated successfully, but these errors were encountered: