env-gen icon indicating copy to clipboard operation
env-gen copied to clipboard

Quoting inconsistently

Open sdoxsee opened this issue 3 years ago • 2 comments

There are a lot of YAML rules about when quotes are necessary or not. I tend to lean towards (almost) always quoting strings (see https://stackoverflow.com/a/67536258/1098564).

Converting between formats adds another challenge as it's not always clear what is or should be a string (e.g. value: 10, or enabled: true, and properties could be whatever type)

sdoxsee avatar Jan 27 '22 17:01 sdoxsee

Love the site, thank you!

In brief

Suggestion: Add a "Quote numbers in YAML output" checkbox (or something like that), preferably also exposed as a query string parameter in the site URL so that I can switch off that behavior in my bookmark for your site.

In detail

Re:

I tend to lean towards (almost) always quoting strings

Personally, I wish your site would lean the other way. 🙂 At least, I'd like to have the option.

e.g. Your site converts the following Spring Boot property:

myapp.some-numeric-property=1234

to the following YAML:

myapp:
  some-numeric-property: '1234'

(with quotes)

whereas:

myapp.some-text-property=abc

gets converted to:

myapp:
  some-text-property: abc

(without quotes)

Why it matters to me: I use a JSON schema in Microsoft Visual Studio Code (with the YAML extension by Red Hat) to validate YAML while I'm editing it.

The schema defines some-numeric-property as an integer; hence, VS Code reports the string value '1234' as a validation error:

Incorrect type. Expected "integer"

GrahamHannington avatar Feb 19 '25 06:02 GrahamHannington

Thanks for the suggestion. Totally makes sense. Would you be interested in submitting a pull request?

sdoxsee avatar Feb 19 '25 13:02 sdoxsee