Swagger 2.0 Validator

Paste a Swagger 2.0 definition, in JSON or YAML, to check that it has the swagger version field, an info object with title and version, and a paths object. Path entries are scanned for a leading slash and for keys that are not standard operations.

How to check a Swagger 2.0 file

  1. 1

    Copy your definition

    Copy the full `swagger.json` or `swagger.yaml`, starting with the `swagger: "2.0"` line.

  2. 2

    Paste it in

    Paste it into the OpenAPI / Swagger document field.

  3. 3

    Run the check

    Continue to the results step to get the errors and warnings.

  4. 4

    Update and recheck

    Apply the fixes in your file and paste the new version until the report is clean.

What counts as a Swagger 2.0 pass

For a 2.0 file, the version check is satisfied by a top-level swagger key. The tool does not verify that its value is "2.0", so it will not catch a wrong number. Beyond the version, it needs info.title, info.version and a paths object.

Fields that are specific to Swagger 2.0, such as host, basePath, schemes, definitions and securityDefinitions, are not examined. A missing host or a broken definitions block will not be reported.

A worked example

{
  "swagger": "2.0",
  "info": { "title": "Shop API", "version": "1.0" },
  "paths": {
    "/products": {
      "get": { "summary": "List products" },
      "x-internal": true
    }
  }
}

The version field, info and paths are all there, so there are no errors. The report shows one warning:

Finding Type Why
Unknown method ‘x-internal’ on /products. Warning The key is not a standard operation or path-item field

The document is still reported as valid, because warnings do not block validity. Vendor extension keys like x-internal are legal in Swagger 2.0, so you can leave it in place.

Migrating from 2.0

If you plan to move to OpenAPI 3.x, you can paste the converted file into the same box and compare results. The check is the same, with the openapi field replacing swagger. Run a full converter and linter for the real migration work, since this tool does not translate definitions or host settings.

When a quick check is enough

Swagger 2.0 definitions often live for years in repositories and get edited by hand. A fast structural check is useful when you inherit one, when a tool refuses to load it and you suspect a missing field, or when you merge two files and want to be sure the result still has its info and paths sections. For the full 2.0 rules, including definitions and security settings, follow up with a dedicated linter.

Keep in mind that a clean report is a statement about structure only. Operations without responses, wrong parameter types and unresolved references are outside this check, so test the file in your documentation or code generation tool as well.

Frequently Asked Questions

No. It checks that the swagger or openapi field exists, not what it contains.

No. Only the version field, the info object, the paths object and the entries under each path are checked.

Yes. The text is read as JSON first and as YAML if that fails. Keep the indentation unchanged when you paste.

Path-level parameters, summary, description and servers are on the list of accepted keys, so they do not trigger the unknown-method warning.

Related Tools

Tool available in other languages

Guides and use cases