OpenAPI / Swagger Validator

Validate OpenAPI 3.0/3.1 and Swagger 2.0 documents structurally: required fields, path/operation completeness, response codes, $ref resolution, operationId uniqueness, and component integrity

Key Facts

Category
Security & Validation
Input Types
textarea
Output Type
html
Sample Coverage
4
API Ready
Yes

Overview

The OpenAPI / Swagger Validator is a web-based utility designed to structurally validate OpenAPI 3.0/3.1 and Swagger 2.0 specifications. It checks for required fields, path and operation completeness, response codes, $ref resolution, operationId uniqueness, and component integrity to ensure your API documentation is accurate and compliant.

When to Use

  • When debugging API specification errors before generating client SDKs or server stubs.
  • When verifying that local OpenAPI 3.0/3.1 or Swagger 2.0 YAML/JSON files comply with official schema standards.
  • When checking for broken internal $ref references or duplicate operationId values in large API definitions.

How It Works

  • Paste your OpenAPI 3.0/3.1 or Swagger 2.0 document in YAML or JSON format into the input text area.
  • The validator parses the document structure, resolving internal and external $ref references.
  • The tool checks for schema compliance, including required fields, unique operation IDs, and valid response codes.
  • Review the generated HTML report detailing any structural errors, warnings, or validation successes.

Use Cases

Validating a newly written OpenAPI 3.0.3 YAML file before committing it to a Git repository.
Troubleshooting broken schema references ($ref) in a complex Swagger 2.0 JSON document.
Ensuring all API endpoints have defined response codes and unique operation IDs for SDK generation.

Examples

1. Resolving Broken Schema References

API Platform Engineer
Background
An engineer is updating a microservice API contract and gets errors when generating client libraries due to unresolved references.
Problem
The API specification contains multiple nested $ref pointers, and some point to non-existent schemas in the components section.
How to Use
Paste the YAML specification into the input area and click validate to locate the exact line numbers of the broken $ref definitions.
Example Config
openapi: 3.0.0
info:
  title: Broken Ref API
  version: 1.0.0
paths:
  /users:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserNonExistent'
Outcome
The validator flags the missing '#/components/schemas/UserNonExistent' reference, allowing the engineer to quickly define the missing schema.

2. Fixing Duplicate Operation IDs

Backend Developer
Background
A developer is merging two API modules into a single Swagger 2.0 specification file.
Problem
The merged file contains duplicate operationId values, which will break the automated SDK generation pipeline.
How to Use
Paste the merged Swagger 2.0 JSON document into the validator text area.
Example Config
{
  "swagger": "2.0",
  "info": {
    "title": "Duplicate ID API",
    "version": "1.0.0"
  },
  "paths": {
    "/items": {
      "get": {
        "operationId": "getItems",
        "responses": { "200": { "description": "Success" } }
      }
    },
    "/products": {
      "get": {
        "operationId": "getItems",
        "responses": { "200": { "description": "Success" } }
      }
    }
  }
}
Outcome
The validator highlights the duplicate 'getItems' operationId, enabling the developer to rename it to 'getProducts' and pass validation.

Try with Samples

validation

Related Hubs

FAQ

Which OpenAPI versions are supported?

The validator supports OpenAPI versions 3.0 and 3.1, as well as Swagger 2.0.

Can I validate both JSON and YAML formats?

Yes, the tool accepts both JSON and YAML formatted API specifications.

How does the tool handle $ref resolution?

It automatically resolves internal references to components and schemas to verify their integrity.

Why is operationId uniqueness important?

Duplicate operationIds cause code generation tools to fail or produce conflicting client SDK methods.

Does this tool store my API specifications?

No, all validation is performed locally in your browser, and your API data is not saved.

API Documentation

Request Endpoint

POST /en/api/tools/openapi-validator

Request Parameters

Parameter Name Type Required Description
specInput textarea Yes -

Response Format

{
  "result": "
Processed HTML content
", "error": "Error message (optional)", "message": "Notification message (optional)", "metadata": { "key": "value" } }
HTML: HTML

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-openapi-validator": {
      "name": "openapi-validator",
      "description": "Validate OpenAPI 3.0/3.1 and Swagger 2.0 documents structurally: required fields, path/operation completeness, response codes, $ref resolution, operationId uniqueness, and component integrity",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=openapi-validator",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]