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

Empty objects in schema fail the doc generation #100

Closed
ovandriyanov opened this issue Dec 2, 2021 · 3 comments
Closed

Empty objects in schema fail the doc generation #100

ovandriyanov opened this issue Dec 2, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@ovandriyanov
Copy link
Contributor

ovandriyanov commented Dec 2, 2021

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

I tried to fix it with this patch: #99

@agouil
Copy link

agouil commented Dec 6, 2021

I have the same problem with generating the docs for my provider. I have a field defined like the one below as Optional with MaxItems: 1 and tfplugindocs returns the same error message when I run it.

resource "provider_resource" "test" {
  name = "test"
  actions {
    some_action {}
  }
}

I have defined some_action as an empty object because at the same time my provider supports,

resource "provider_resource" "test" {
  name = "test"
  actions {
    another_action {
      field = "foobar"
    }
  }
}

@detro detro added the bug Something isn't working label May 31, 2022
@detro
Copy link
Contributor

detro commented May 31, 2022

Fixed by #134

@detro detro closed this as completed May 31, 2022
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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants