-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Is it possible to decode sum types in such a way that there is no tag field, no content field, to be able to parse sum types from json that are coming from a Rust server* using serde encoding (with default serde settings)?
print(PossibleValues::NumberValue(NumberValueRecord { a: 123, b: 42 }));
print(PossibleValues::StringValue(StringValueRecord { a: 123, b: "asd".to_string() }));
print(PossibleValues::Empty);serialized = {"NumberValue":{"a":123,"b":42}}
serialized = {"StringValue":{"a":123,"b":"asd"}}
serialized = "Empty"There is no tag or content field. I think I need ObjectWithSingleField but nullary constructors shouldn't be { "foo": [] } but "foo" (flattenContentsArray = true), is that combination possible in PureScript with automatic/generic deserialization?
*The API can't be changed anymore on the server-side because many apps and services already depend on it.
Metadata
Metadata
Assignees
Labels
No labels