hashicorp / terraform-plugin-codegen-spec

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

Data sources and resources should validate with attributes and/or blocks #42

Closed bendbennett closed 12 months ago

bendbennett commented 12 months ago

The schema required that attributes be present for data sources and resources.

This PR modifies the schema to require that data sources and resources have attributes and/or blocks.

minProperties has been used for this purpose because using anyOf gives rise to a misleading error message. For instance, updating the schema to use:

      "anyOf": [
        {
          "required": [
            "attributes"
          ]
        },
        {
          "required": [
            "blocks"
          ]
        }
      ]

Results in the following error message if both attributes and blocks are omitted from a data source or resource:

datasources.0.schema: attributes is required
github-actions[bot] commented 3 months ago

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.