Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code does not support round-tripping of unknown enum/union types #24

Open
nmiyake opened this issue Jan 14, 2019 · 1 comment

Comments

@nmiyake
Copy link
Contributor

nmiyake commented Jan 14, 2019

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.

@nmiyake
Copy link
Contributor Author

nmiyake commented Jan 14, 2019

@bmoylan for SA since he's actively doing work in the area of Conjure serialization right now

@bmoylan 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant