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

JSON and MsgPack don't handle OptionalAttributes correctly #97

Open
paddycarver opened this issue Aug 9, 2021 · 1 comment
Open

JSON and MsgPack don't handle OptionalAttributes correctly #97

paddycarver opened this issue Aug 9, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@paddycarver
Copy link
Contributor

terraform-plugin-go version

v0.3.1

Expected Behavior

Complex types that have object elements or attributes that contain optional attributes (a map of objects with optional attributes, an object with an object attribute that has optional attributes, etc.) should be surfaced as a value without optional attributes when surfaced from msgpack or JSON.

Actual Behavior

The values retain their type constraints as types, instead of the actual type. Meaning they'd still have optional attributes as part of their type, instead of their concrete type.

References

@paddycarver paddycarver added the bug Something isn't working label Aug 9, 2021
@paddycarver
Copy link
Contributor Author

Upon investigation, it looks like the only real problem here is that if we have an Object with OptionalAttributes, the msgpackUnmarshal code for null/unknown values will preserve the OptionalAttributes. DynamicPseudoType seems to be handled correctly. Objects that have values besides unknown/null have their OptionalAttributes stripped appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant