-
Notifications
You must be signed in to change notification settings - Fork 94
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
State #26
Closed
Closed
State #26
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Start building out the schema type, leaving some TODOs for things I'm still mulling over and thinking about. This also brings in the StringKind type, which is a pattern I'm not thrilled about and we should probably think about it some more. I also included the AttributeType and AttributeValue types, which I'll add a package with some builtins for in a future commit, to show off how they're used.
Add implementations of lists and strings, so we can see what an actual type may look like under this system, and to make sure that complex types still work under this system.
Try tweaking the package architecture a bit. Add more types. Make the AttributeTypes more composable. Make nested attributes and descriptions a bit less verbose to work with. Rename our root package to tfsdk.
Spitball on what retrieving state in a way that lets users access it with types and no type assertions may look like.
Closed
Add an internal reflect package, with one exported function, Into. This lets us use common reflection rules to map a tftypes.Value onto a Go type. This doesn't handle unknown or null flags yet. My current thoughts are that we'll have flags for different options re: handling those situations: * we can error if an unknown or null value is encountered * we can treat unknown and null as empty values, flattening out some context * we can see if there's an optional `SetKnown` and `SetNull` method on the Go type being targeted, and call it if there is, letting users opt into caring about these details if they want. Also updated the List type to use this new package. Committing to share, going to think a bit more on the design of the thing: * Are we sure we want to go from tftypes.Value instead of from AttributeValue? * Let's get null and unknown values taken care of * teeeeeeessssts * the godoc could honestly be much more helpful
Make it configurable whether null and unknown values can be substituted for empty values when they're not supported by the type they're being put into. Make it so types can have a SetUnknown and SetNull method that's called to handle null and unknown values. Let pointers to pointers, pointers to maps, pointers to slices, and pointers to interfaces be set to nil when there's a null value. Fix a potential panic in reflectPrimitive by making sure the value can be set before we try to set it.
Merged
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
needs #11
types
attr.ObjectType
interfacereflect.OutOf
, plus testsGet