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

Treat empty blocks with MinItems == 0 as optional #99

Closed
wants to merge 2 commits into from

Conversation

ovandriyanov
Copy link
Contributor

@ovandriyanov ovandriyanov commented Dec 2, 2021

This patch allows for generating documentation for those providers which have empty objects in their schema, i.e, the objects with no attributes and no nested blocks.

Terraform allows providers to have empty objects in their schema, but currently terraform-plugin-docs does not recognize such empty fields neither as required, nor optional, nor read-only, and thus cannot generate docs for such providers and raises an error like the following:

no match for empty_block_field, this can happen if you have incompatible schema
defined, for example an optional block where all the child attributes are
computed, in which case the block itself should also be marked computed

Fix it by handling such empty blocks explicitly.

Closes #100

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 2, 2021

CLA assistant check
All committers have signed the CLA.

@GennadySpb
Copy link
Contributor

@bflad Please check this PR: I got same issue as #100

@ovandriyanov ovandriyanov requested a review from a team as a code owner March 16, 2022 18:44
Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, erroneous approval.

This is good, but we need BUG FIXES entry added to the CHANGELOG

@detro detro added this to the v0.8.0 milestone Apr 26, 2022
@detro
Copy link
Contributor

detro commented Apr 26, 2022

Sorry, I think I should have been more explicit.

The changelog format is defined here https://www.terraform.io/plugin/sdkv2/best-practices/versioning#changelog-specification .

Your change will be part of 0.8.0.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 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

Successfully merging this pull request may close these issues.

Empty objects in schema fail the doc generation
4 participants