Skip to content

Expose the tags.description field in the Open API spec to use as resource/data source schema description  #123

Open
@andreaangiolillo

Description

@andreaangiolillo

Use Cases or Problem Statement

The autogen tool does not populate the Schema.Description and Schema.MarkdownDescription fields for a TF resource or data source.

Example:

What is happening

func DataSourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed:            true,
				Description:         "Unique 24-hexadecimal digit string that identifies the search deployment.",
				MarkdownDescription: "Unique 24-hexadecimal digit string that identifies the search deployment.",
			},
			"cluster_name": schema.StringAttribute{
				Required:            true,
				Description:         "Label that identifies the cluster to return the search nodes for.",
				MarkdownDescription: "Label that identifies the cluster to return the search nodes for.",
			},
			"project_id": schema.StringAttribute{
				Required:            true,
				Description:         "Unique 24-hexadecimal digit string that identifies your project.",
				MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
			},

Expectation

func DataSourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		MarkdownDescription: "Provides a Search Deployment data source.",
		Description: "Provides a Search Deployment data source.",
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed:            true,
				Description:         "Unique 24-hexadecimal digit string that identifies the search deployment.",
				MarkdownDescription: "Unique 24-hexadecimal digit string that identifies the search deployment.",
			},
			"cluster_name": schema.StringAttribute{
				Required:            true,
				Description:         "Label that identifies the cluster to return the search nodes for.",
				MarkdownDescription: "Label that identifies the cluster to return the search nodes for.",
			},
			"project_id": schema.StringAttribute{
				Required:            true,
				Description:         "Unique 24-hexadecimal digit string that identifies your project.",
				MarkdownDescription: "Unique 24-hexadecimal digit string that identifies your project.",
			}

Proposal

Use the tags.name and tags.description in the OpenAPI spec to populate these fields. Another option would be to auto-populate these fields with a predefined format such as "Define a data source for { .Name }."

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