简体   繁体   中英

Is swagger tools use only json format

I'm using swagger for my API documentation of nodejs API. But as a beginner I am not aware about swagger ui. I google it and find a solution for that which is swagger tool but in the swagger tool documentation they use json format but my question is cant we use swagger.yaml (YAML) format for do the same thing.

According to the OpenAPI Specification (emphasis mine):

An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format .

Swagger UI can handle both JSON and YAML definitions. Other OpenAPI-related tools should too - provided that they use a YAML parser. Technically, YAML is a superset of JSON so tools that use YAML parsers (rather than JSON parsers) can parse both YAML and JSON.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM