ValueOrRange Serialize Issue
Closed this issue · 0 comments
bjohnson5 commented
Describe the bug
Serializing a ValueOrRange type to json turns the object into a string. Then when deserializing the sim.json file you get this error:
data did not match any variant of untagged enum ValueOrRange
This is really only an issue if you are using simln
as a library and creating simulations directly in rust (not loading sim.json
files)
To Reproduce
- Use
sim-lib
to create a simulation with a list ofActivityParser
types - Use
serde_json::to_string
to serialize the list to json - Write the json data to a file so that it can be used as a
sim.json
for in a later simulation - Try to load the saved
sim.json
file and get the error
I believe this is due to the custom serializer that simply uses serialize_str
to serialize the ValueOrRange