Closed Feliix42 closed 6 years ago
No it is not intended as such.
In fact the "source"
field is in habited by the Source
type which is an algebraic data type and can have two representations. Either it is a local source ("type"
field has value "local"
) or a value from the environment ("type"
field has value "env"
).
In case of a local source the "val"
field contains a value of type Target
and in case it is an environment argument "val"
contains the numeric reference to that environment arg.
Ok, it's my fault then. Thanks for the explanation!
The JSON file that is generated from the test file (
test-resources/some_ns.ohuac
) is not consistent. For an arc source value, it either yields0
or another JSON object. An example is shown below.If I see this correctly, this behaviour is intended to function as the JSON equivalent of an Optional or a Maybe. If this is the case, I suggest to replace the
0
fields with the JSONnull
value.This would enable me to natively deserialise the
val
field as anOption<T>
type in Rust. 🙃 But if this is intended behaviour andval
can be an integer value != 0 or this cannot be changed, I have to come up with a workaround to parse the file.