Forum Discussion

Jojoba123's avatar
Jojoba123
Occasional Visitor
4 years ago

Does swagger json / yaml have a specific identifier?

I wanna detect a swagger file via google extension so ı need a specific identifiers. I didn't find any value except open api: and swagger:

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    An OpenAPI file is a YAML or JSON file that has a field named swagger or openapi at the root level.

    For example:

    {
      "swagger": "2.0",
      ...
    }

    or

    openapi: 3.0.3
    info:
      title: test
      version: 1.0.0
    paths:
      ...

     

    There are also parsers for various programming languages that can tell you if a file is a valid OpenAPI file.