eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
663 stars 61 forks source link

JsonSerializer and References #1458

Open cdietrich opened 2 months ago

cdietrich commented 2 months ago

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

msujew commented 2 months ago

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?

cdietrich commented 2 months ago

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