Skip to content

"::1" is a "native" string ? #312

@samos667

Description

@samos667

I've been using it for years with minimal configuration. Considering how difficult YAML is, I think your tool is amazing!

Normally when a value is a "true"/"native" string like:

- "a"
- "1a"
- "1.1.1"

yamlfix remove the unnecessary quotes(BTW it seems that Github linter interpret '1a' as a int ? or at least not a string when looking at the color x)):

- a
- 1a
- 1.1.1

but there is some canvas, example when the string start with a "{}" or "[]" (first the user should quote the string, normal cuz there is not indication that is string a not a struct/list):

- "{HELLO}"
- "[WORLD]"

For these case, yamlfix do also the good thing and doesn't override it by removing quote
but here a more tricky one:

- "::1" # or '::1'

is always rewrite to

- ::1

what is not a valid yaml, at least for kubernetes:

yaml.parser.ParserError: while parsing a flow node
expected the node content, but found ':'
  in "<unicode string>", line 12, column 23:
            nameservers: [::1]

helm-controller could not resolve ConfigMap chart values reference 'stalwart/stalwart' with key 'values.yaml': error converting YAML to JSON: yaml: line 11: did not find expected node content

But my IDE (yaml-language-server and yamlfix too) doesn't report me any error

Image

Question

This a "bug" from yamlfix/my IDE or it is really a invalid YAML without the quote? And there any config (except add a exception for the concerned file) on yamlfix that I can tweak to prevent this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions