hashicorp / terraform-plugin-codegen-spec

Terraform Provider Code Generation Specification and Go Bindings
Mozilla Public License 2.0
7 stars 4 forks source link

Consider improving path handling for duplicate name errors #18

Open bendbennett opened 1 year ago

bendbennett commented 1 year ago

Currently, spec.Validate recursively interrogates data sources and resources for duplicate names that either appear on the data sources and resources themselves at the provider-level and, for duplicate names that appear on attributes, blocks and elements within objects at the same nesting level within schema. When such duplicates are found, errors are raised and bubbled-up to the caller. The error uses a req.Path which is supplied in the argument to the Validate() methods. The req.Path takes the form of a string that denotes the current nesting level for use in generating error messages. This could likely be improved by using a similar approach to the Framework in making the path available within the Validate() methods.