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

State #26

Closed
wants to merge 17 commits into from
Closed

State #26

wants to merge 17 commits into from

Conversation

kmoe
Copy link
Member

@kmoe kmoe commented May 25, 2021

needs #11

  • Add Object type to types
  • Add attr.ObjectType interface
  • Add reflect.OutOf, plus tests
    • implement remaining types
  • Get example code working
  • Implement all versions of Get

@kmoe kmoe changed the title State Further State experiments May 25, 2021
paddycarver and others added 7 commits May 25, 2021 11:47
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.
@kmoe kmoe mentioned this pull request May 25, 2021
kmoe and others added 10 commits May 25, 2021 17:32
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.
@kmoe kmoe changed the title Further State experiments State May 27, 2021
@kmoe kmoe mentioned this pull request Jun 1, 2021
@paddycarver paddycarver added this to the v0.1.0 milestone Jun 1, 2021
@kmoe kmoe mentioned this pull request Jun 2, 2021
@kmoe
Copy link
Member Author

kmoe commented Jun 6, 2021

Superseded by #39 and #43.

@kmoe kmoe closed this Jun 6, 2021
@github-actions
Copy link

github-actions bot commented Jul 7, 2021

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2021
@bflad bflad deleted the katystate2 branch January 11, 2023 17:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants