-
Notifications
You must be signed in to change notification settings - Fork 18
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
Remove attribute and block schema templates #99
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.
This all looks good to me, if you want to continue with resource/data source and the other types, I'm good with merging this 🚀
@@ -96,46 +113,22 @@ func (g GeneratorBoolAttribute) Equal(ga generatorschema.GeneratorAttribute) boo | |||
return false | |||
} | |||
|
|||
return g.BoolAttribute.Equal(h.BoolAttribute) | |||
return true | |||
} | |||
|
|||
func (g GeneratorBoolAttribute) Schema(name generatorschema.FrameworkIdentifier) (string, error) { |
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.
Much cleaner and easier to read! I'm a big fan 😄
…d attributes and list, set nested blocks
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.
sweet! at a high-level these changes all LGTM. It will be nice to be able to place debug breakpoints in the middle of all this code generation if we need to 😄
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. |
This PR is a follow-up to Consolidate convert and generate packages for datasource, provider, and resource.
The intention is to remove usage of attribute and block schema templates (e.g.,
bool_attribute.gotmpl
,set_nested_block.gotmpl
), and to replace with calls to reusable attribute, and block field methods (e.g.,ComputedOptionalRequired.Schema()
).Previous implementation of the
Schema()
method onGeneratorBoolAttribute
looked as follows:The
Schema()
method onGeneratorBoolAttribute
now appears as:Further Refactoring
With the changes in this PR, new types (e.g.,
CustomTypePrimitive
) have been added. At this point, theterraform-plugin-codegen-spec
CustomType
, is held in more than one location within theGenerator<Type>Attributes
. For example:The
CustomType
field will be refactored out ofGeneratorBoolAttribute
as the functions that make use of this field (e.g.,Imports()
,ModelField()
) are refactored to useCustomTypePrimitive
.Equivalent changes will be made for all fields across the various generator types during subsequent refactoring.