langium
langium copied to clipboard
JsonSerializer and References
Currenty the JsonSerializer can't (de)serialize References that cannot be resolved.
It would be nice to have an flag in the JsonSerializeOptions to omit serializing the reference?
do i overlook something that makes this impossible? (am not sure about the derserialization aspects)
our usecase is to test the parser. there we care about the ast structure only and not any errors in resolving
Just to clear things up, because I haven't tried it yet. Does the JsonSerializer throw an error when trying to serialize a non-resolved reference?
no but it includes
{
"ref": Object {
"$refRef": b,
"$error": "Could not resolve reference to NamedDotTargetReference named 'b'.",
}
}
but we dont care about $error (or the uri) when asserting on the ast