swagger-jsdoc icon indicating copy to clipboard operation
swagger-jsdoc copied to clipboard

JSON is also valid YAML

Open Hypfer opened this issue 4 years ago • 5 comments

Since YAML is a superset of JSON, we can also accept json files here.

Hypfer avatar May 05 '21 14:05 Hypfer

can you add tests to your pr?

daniloab avatar May 20 '21 12:05 daniloab

Well that would essentially mean testing the YAML parser itself since that's just the spec.

See https://yaml.org/spec/1.2/spec.html#id2759572

YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file. This makes it easy to migrate from JSON to YAML if/when the additional features are required.

Hypfer avatar Jun 01 '21 06:06 Hypfer

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '21 08:07 stale[bot]

ping

Hypfer avatar Jul 31 '21 08:07 Hypfer

@daniloab but tests are already loading files in JSON format: https://github.com/Surnet/swagger-jsdoc/blob/master/test/lib.spec.js#L208

EDIT: You could add test for .json format here to test your functionality: https://github.com/Surnet/swagger-jsdoc/blob/master/test/specification.spec.js#L106

SimonKocurek avatar Aug 05 '21 09:08 SimonKocurek