Skip to content

Generated documentation fails validation #445

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

Open
1 task done
jedesroches opened this issue Feb 6, 2025 · 0 comments · May be fixed by #446
Open
1 task done

Generated documentation fails validation #445

jedesroches opened this issue Feb 6, 2025 · 0 comments · May be fixed by #446
Labels
bug Something isn't working

Comments

@jedesroches
Copy link

jedesroches commented Feb 6, 2025

Terraform CLI and terraform-plugin-docs Versions

$ terraform version
Terraform v1.9.8
on darwin_amd64

Your version of Terraform is out of date! The latest version
is 1.10.5. You can update by downloading from https://www.terraform.io/downloads.html


$ go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs --version
tfplugindocs Version dev

Provider Code

N/A

Expected Behavior

When generating documentation with go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir . --provider-name name --examples-dir examples, then the validate command using go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs validate --provider-dir . --provider-name name should not report an error.

Actual Behavior

The actual output of the validate command is:

exporting schema from Terraform
compiling provider "name"
using Terraform CLI binary from PATH if available, otherwise downloading latest Terraform CLI binary
running terraform init
getting provider schema
2025/02/06 14:56:14 [DEBUG] Found documentation files [docs/data-sources/xxx.md docs/data-sources/yyy.md docs/index.md docs/resources/xxx.md docs/resources/yyy.md docs/resources/zzz.md]
running mixed directories check
2025/02/06 14:56:14 [DEBUG] Found directory: docs/data-sources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/data-sources
2025/02/06 14:56:14 [DEBUG] Found directory: docs
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
detected static docs directory, running checks
running invalid directories check on docs/data-sources
running file checks on docs/data-sources/xxx.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/data-sources/xxx.md
2025/02/06 14:56:14 [DEBUG] File docs/data-sources/xxx.md size: 516 (limit: 500000)
running file checks on docs/data-sources/yyy.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/data-sources/yyy.md
2025/02/06 14:56:14 [DEBUG] File docs/data-sources/yyy.md size: 489 (limit: 500000)
running file checks on docs/index.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/index.md
2025/02/06 14:56:14 [DEBUG] File docs/index.md size: 816 (limit: 500000)
running invalid directories check on docs/resources
running file checks on docs/resources/xxx.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/xxx.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/xxx.md size: 524 (limit: 500000)
running file checks on docs/resources/zzz.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/zzz.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/zzz.md size: 615 (limit: 500000)
running file checks on docs/resources/yyy.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/yyy.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/yyy.md size: 372 (limit: 500000)
running file mismatch check
2025/02/06 14:56:14 [DEBUG] Found file xxx.md
2025/02/06 14:56:14 [DEBUG] Found file yyy.md
2025/02/06 14:56:14 [DEBUG] Found file zzz.md
2025/02/06 14:56:14 [DEBUG] Found resource xxx
2025/02/06 14:56:14 [DEBUG] Found resource yyy
2025/02/06 14:56:14 [DEBUG] Found resource zzz
2025/02/06 14:56:14 [DEBUG] Found file xxx.md
2025/02/06 14:56:14 [DEBUG] Found file yyy.md
2025/02/06 14:56:14 [DEBUG] Found datasource xxx
2025/02/06 14:56:14 [DEBUG] Found datasource yyy
Error executing command: validation errors found:
docs/index.md: error checking file frontmatter: YAML frontmatter should not contain subcategory

exit status 1

Note that in docs/index.md, the subcategory field is set to "".

Steps to Reproduce

  1. tfplugindocs generate --provider-dir . --provider-name name --examples-dir examples
  2. tfplugindocs validate --provider-dir . --provider-name name

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Setting the category to something else than the empty string does not fix the issue 🤷

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jedesroches jedesroches added the bug Something isn't working label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant