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
For my use case I have to differentiate between different types of doubles (percentages vs amounts) which is done with strong typedefs as seen in the example struct. This works fine for structs containing the typedef but it doesn't work with variants.
It seems to violate the rule that no JSON type can occur twice in a variant as the schema states all types as JSON types as being possible (generated schema in 2nd example, parsing error in 3rd example).
Is it possible to only allow numbers as input to a custom read/write so I can use a variant like TestStruct below?
For my use case I have to differentiate between different types of doubles (percentages vs amounts) which is done with strong typedefs as seen in the example struct. This works fine for structs containing the typedef but it doesn't work with variants.
It seems to violate the rule that no JSON type can occur twice in a variant as the schema states all types as JSON types as being possible (generated schema in 2nd example, parsing error in 3rd example).
Is it possible to only allow numbers as input to a custom read/write so I can use a variant like
TestStruct
below?Struct
Schema
results in:
Parsing
TestStruct inputStruct; std::string inputString = "{ \"testing\": 1.1 }"; glz::error_ctx glazeError = glz::read_json<TestStruct, std::string&>(inputStruct, inputString);
results in:
2:11: no_matching_variant_type "input": { ^
The text was updated successfully, but these errors were encountered: