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

Consider modifying validation to account for duplicate names used in attributes and blocks #34

Open
bendbennett opened this issue Jul 7, 2023 · 0 comments

Comments

@bendbennett
Copy link
Contributor

Within the terraform-plugin-codegen-framework, models are generated from the specification. Currently, it is possible for the specification to contain names that are duplicated across attributes and blocks. For instance, the following intermediate representation is currently permitted

{
{
  "datasources": [
    {
      "name": "datasource",
      "schema": {
        "attributes": [
          {
            "name": "one",
          }
        ],
        "blocks": [
          {
            "name": "one",

This results in the generation of a valid schema with the following form:

datasourceDataSourceSchema = schema.Schema{
	Attributes: map[string]schema.Attribute{
		"one": /*...*/
	},
	Blocks: map[string]schema.Block{
		"one": /*...*/
	},
}

However, it also results in the generation of an invalid model with the following form:

type DatasourceModel struct {
	One types.Bool `tfsdk:"one"`
	One types.List `tfsdk:"one"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant