-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add code generation for collection and object attributes with associated external type #75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions, but overall lgtm 🚀
internal/schema/elements.go
Outdated
if e.List.CustomType != nil { | ||
return e.List.CustomType.ValueType | ||
} | ||
return "types.ListType" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this meant to be: types.List
?
Same for the others below:
types.Map
types.Object
types.Set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! You're quite right. Have fixed.
diags.Append(d...) | ||
|
||
if diags.HasError() { | ||
return NewExampleValueNull(), diags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the From*
functions, if there is an error, do we want to default to returning Unknown? Just to be sure there is an error if the provider dev doesn't check the diags 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout. I've updated List, Map, Object, and Set. I also updated for nested object (i.e., list, map, set, single nested attribute, and list, set, single nested block).
…for data source list attribute (#74)
…for set attribute for data source, and list, and set attribute for provider and resource (#74)
…for map attribute for data source, provider and resource (#74)
…te to use associated external type (#74)
…map, set, single nested attribute, or list, set, single nested block (#74)
…ect attribute for data source, provider, and resource (#74)
a284d41
to
48bfbfa
Compare
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. |
Closes: #74
The following is illustrative for the handling of object attributes with associated external types. Analogous changes have been made for the handling of list, map, and set attributes with associated external types.
Given the following spec:
Prior to the changes in this PR, the generated code would have looked as follows:
With the changes in this PR the generated code is now as follows: