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
This means that, even if a union unmarshals into an "unknown" type, it should be able to re-marshal the unknown union into its original form.
Currently, the generated code does not do this -- although it will unmarshal unknown variants, the serializer code returns an error when an unmarshaled unknown is re-marshaled.
In order to fix this, the generated unions will likely need to store the raw JSON and re-write that when it is marshaled. Not sure if there's a straightforward way to properly support this for YAML, but at the very least we should match the required JSON behavior.
The text was updated successfully, but these errors were encountered:
@bmoylan for SA since he's actively doing work in the area of Conjure serialization right now
bmoylan
changed the title
Generated code does not support round-tripping of unknown enum types
Generated code does not support round-tripping of unknown enum/union types
Sep 15, 2020
The Conjure specification stipulates that clients should be able to round-trip unknown variants of enums and unions: https://github.com/palantir/conjure/blob/master/docs/spec/wire.md#44-round-trip-of-unknown-variants
This means that, even if a union unmarshals into an "unknown" type, it should be able to re-marshal the unknown union into its original form.
Currently, the generated code does not do this -- although it will unmarshal unknown variants, the serializer code returns an error when an unmarshaled unknown is re-marshaled.
In order to fix this, the generated unions will likely need to store the raw JSON and re-write that when it is marshaled. Not sure if there's a straightforward way to properly support this for YAML, but at the very least we should match the required JSON behavior.
The text was updated successfully, but these errors were encountered: