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

String "yes" is interpreted wrong #116

Closed
remcohaszing opened this issue Sep 21, 2018 · 8 comments
Closed

String "yes" is interpreted wrong #116

remcohaszing opened this issue Sep 21, 2018 · 8 comments
Labels

Comments

@remcohaszing
Copy link

Given a Kubernetes MySQL deployment file:

apiVersion: extensions/v1beta1
kind: Deployment
# ...
spec:
  # ...
  template:
    # ...
    spec:
      containers:
        - env:
            - name: MYSQL_RANDOM_ROOT_PASSWORD
              value: "yes"
          # ...

The value yes is a string. However, I am getting the following error in VSCode:

Incorrect type. Expected "string".

Probably the string "yes" is incorrectly marked as a boolean.

@JPinkney JPinkney added the bug label Sep 26, 2018
@JPinkney
Copy link
Contributor

It is marked as boolean because yaml spec says "yes" should be marked as boolean http://yaml.org/type/bool.html

@remcohaszing
Copy link
Author

It is marked as boolean because yaml spec says "yes" should be marked as boolean http://yaml.org/type/bool.html

No, it doesn’t. In the definition where yes is quoted, the quote is used as punctuation. The regular expression doesn’t contain any quotes. Also libraries and tools seem to agree that "yes" should be treated as a string.

> require('js-yaml').load('"yes"')
'yes'
>>> import yaml
>>> yaml.load('"yes"')
'yes'

The example in the original issue is part of a valid Kubernetes configuration file. I need to define an environment variable MYSQL_RANDOM_ROOT_PASSWORD=yes. This is how it is done. All tools accept it, except vscode-yaml.

@JPinkney
Copy link
Contributor

It will be fixed in tomorrows release.

JPinkney added a commit to redhat-developer/yaml-language-server that referenced this issue Sep 27, 2018
JPinkney added a commit to redhat-developer/yaml-language-server that referenced this issue Nov 8, 2018
@tristan957
Copy link

same as "no". Not sure if that was fixed as well

@tristan957
Copy link

Looks like it was. thanks :)

@tomasaschan
Copy link

With the latest released version of this extension I'm still seeing this error (for the mapping value: 'Yes'). Was this fix released yet? If not, when can I expect an update? :)

@JPinkney
Copy link
Contributor

JPinkney commented Dec 6, 2018

The fix hasn't been released yet. I won't be able to do a release until December 20th but that release will include the fix.

@JPinkney
Copy link
Contributor

This should be fixed now!

bleach31 pushed a commit to bleach31/vscode-yaml that referenced this issue Jan 25, 2022
…_tab_size

Use tabWidth setting from editor when formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants