webhook icon indicating copy to clipboard operation
webhook copied to clipboard

Undocumented YAML support breaks JSON style comments in config file

Open computator opened this issue 6 years ago • 4 comments

I was writing a config file and was getting an error message

couldn't load hooks from file! error converting YAML to JSON: yaml: line 7: did not find expected ',' or ']'

I had commented out a line for testing, but it turns out the // comment was breaking it. Noticing the message about YAML, I tried using # to comment it out instead and everything worked correctly.

It would be nice if the support for YAML was documented (possibly with some examples) because it is much easier to use for manually written configs. It would also be nice if both styles of comments were supported.

computator avatar Dec 05 '18 07:12 computator

Ugh, that's why I hate magic in applications :-(

We should definitely improve YAML support, documentation, and make it an explicit option instead of magically loading it and then falling back to JSON if it doesn't work...

Thanks.

adnanh avatar Dec 14 '18 10:12 adnanh

I found this issue after getting a JSON parser error even though I provided a YAML config.

Isn't YAML basically a superset of JSON, so using only a YAML parser would work just as well for both formats? It might depend on the parser but it might be worth a try ;)

Update: it turns out I had errors in my YAML syntax. Always use a linter, kids!

cbix avatar Feb 11 '21 13:02 cbix

Isn't YAML basically a superset of JSON...

For the record, YAML is not a superset of JSON.

moorereason avatar Feb 11 '21 14:02 moorereason

Per https://yaml.org/spec/1.2/spec.html

The primary objective of this revision is to bring YAML into compliance with JSON as an official subset.

computator avatar Feb 11 '21 17:02 computator