redhat-developer / redhat-developer/yaml-language-server

Error setting a variable to an enum attribute

Open
#995 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

Describe the bug

Working on a serverless project in vscode, I came across this problem -
Trying to set a variable to an attribute defined as an enum - i get "value is not accepted. valid values: ...".

See this simplified version:

service: test-service

provider:
  name: aws
  region: ${env:AWS_REGION} # this value gets an error

Expected Behavior

I'd expect it to be a warning or less.

Current Behavior

I get an error reported.

Steps to Reproduce

Just put this example in a file called serverless.yml and open with vscode, then wait a bit for the linting to happen.
Adding useDotenv: true or using the serverless-dotenv-plugin doesn't change this.

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem by opening the provided serverless.yml example in VS Code and waiting for linting. Investigate the YAML language server's handling of an environment-variable substitution in an enum-valued attribute; done means the substitution no longer produces an error, but is treated as a warning or less severe diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.