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

decoder: validateBody should ignore missing provider schemas #291

Closed
dbanck opened this issue Jul 31, 2023 · 0 comments · Fixed by #301
Closed

decoder: validateBody should ignore missing provider schemas #291

dbanck opened this issue Jul 31, 2023 · 0 comments · Fixed by #301
Assignees
Labels
enhancement New feature or request

Comments

@dbanck
Copy link
Member

dbanck commented Jul 31, 2023

Requires #287

Problem Statement

We currently compare all blocks and attributes against the available schema. We don't distinguish between a missing schema or a block that doesn't accept any attributes. Since we only bundle the ~250 official and partner providers with terraform-ls, it is likely that we will encounter providers for which we don't have a schema yet.

Instead of raising diagnostics for unknown attributes / blocks we should not raise any.

Proposal

  • Update validateBody to skip resources/blocks when validating a file if we don't have a schema
    • Return an additional boolean from mergeBlockBodySchemas to indicate if merging was successfull
    • If merging is successful we can continue as normal
    • If not, we have to skip some validations, like required attribute/block detection
    • If we encounter a attribute/block that still exists in the schema (must be part of the core schema then), we can return to normal validation for that one

Part of hashicorp/vscode-terraform#720

@dbanck dbanck added the enhancement New feature or request label Jul 31, 2023
@dbanck dbanck changed the title decoder: validateFilePerSchema ignore missing provider schemas decoder: validateBody should ignore missing provider schemas Aug 2, 2023
@radeksimko radeksimko self-assigned this Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants