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

Resource schema documentation generation ignores property values #275

Closed
mschuchard opened this issue Aug 11, 2023 · 3 comments
Closed

Resource schema documentation generation ignores property values #275

mschuchard opened this issue Aug 11, 2023 · 3 comments

Comments

@mschuchard
Copy link

mschuchard commented Aug 11, 2023

For a given schema:

"foo": resource.StringAttribute{
    Optional:    !boolSwitch,
    Computed:    boolSwitch,
    Description: "Cool beans.",
}

the property values of Required, Optional, and Computed are ignored during document generation. The observed behavior is that if the Computed field exists in the struct then the generated document for the schema will mark the parameter foo as Read-Only regardless of property values.

@bendbennett
Copy link
Contributor

Hi @mschuchard 👋

I've just tried to reproduce the behaviour you describe.

I'm seeing the following:

Required

"configurable_attribute": schema.StringAttribute{
	Required:            true,
	MarkdownDescription: "Example configurable attribute",
},
### Required

- `configurable_attribute` (String) Example attribute

Optional

schema.StringAttribute{
	Optional:            true,
	MarkdownDescription: "Example attribute",
},
### Optional

- `configurable_attribute` (String) Example attribute

Optional + Computed

"configurable_attribute": schema.StringAttribute{
	Optional:            true,
	Computed:            true,
	MarkdownDescription: "Example attribute",
},
### Optional

- `configurable_attribute` (String) Example attribute

Computed

"configurable_attribute": schema.StringAttribute{
	Computed:            true,
	MarkdownDescription: "Example attribute",
},
### Read-Only

- `configurable_attribute` (String) Example attribute

Specifying that an attribute is both optional and computed seems to mark the attribute as Optional in the docs at this end.

@mschuchard
Copy link
Author

mschuchard commented Aug 11, 2023

Yes I am returning here to note that now my go generate is producing the expected schema documentation. I think I had some bizarre fluke during one execution because that was the only time I noticed the behavior. I assume I did something odd in the schema during that one execution to cause the behavior.
Closing.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants