Skip to content

Consider adding nested block support as alternative to nested attribute #106

Open
@austinvalle

Description

@austinvalle

Use Cases or Problem Statement

Currently, the OpenAPI provider spec generator will always default to nested attributes when generating resource/data source/provider schemas with structural/collection types. This however requires that a provider be implemented with protocol v6 support and may not be desired for provider developers who want to use this tool for migrating from SDKv2 to Framework.

The provider code spec and tfplugingen-framework already support blocks.

Proposal

Implement support for generating nested blocks which can be supported on protocol v5. We want to encourage using nested attributes whenever possible, so we could introduce this as an opt-in configuration per-resource.

Example:

provider:
  name: petstore

data_sources:
  pet:
    read:
      path: /pet/{petId}
      method: GET
    schema:
      # Object = SingleNestedBlock, Collection = ListNestedBlock, Set= SetNestedBlock
      v5: true

There are likely some edge-cases we might not be able to handle or express fully with the code generator (such as maps), so we'll need to determine how best to surface this information to users.

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions