Free, browser-based utilities for everyday developer workflows

Validate OpenAPI schema example JSON

Check whether an example request or response matches the schema you defined in OpenAPI. OpenAPI Schema Objects are JSON Schema based, so you can validate examples for required fields, types, and enums.

Open this example in JSON Schema Validator

Open the tool, then paste the sample input below. Everything runs locally in your browser.

Open this example in JSON Schema Validator →

The problem

Documented examples drift from the schema over time. Validating the example JSON against the schema catches missing required fields, wrong types, and invalid enum values before they reach a client or a contract test.

Sample input

Schema
{
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": { "type": "integer" },
    "email": { "type": "string", "format": "email" },
    "status": { "type": "string", "enum": ["active", "inactive"] }
  }
}
Valid example
{
  "id": 101,
  "email": "asha@example.com",
  "status": "active"
}
Invalid example
{
  "id": "101",
  "status": "enabled"
}

Expected output

Errors for the invalid example
id      should be an integer (got a string)
email   is required but missing
status  should be one of: active, inactive

The valid example passes. The invalid example fails three checks: wrong type for id, missing required email, and an out-of-range status enum.

How to do it

  1. Paste the schema (an OpenAPI Schema Object or JSON Schema).
  2. Paste the example JSON to validate.
  3. Run validation.
  4. Review each error with its path and reason.
  5. Fix the example or the schema and re-validate.

Common mistakes

  • Leaving out a required field.
  • Using the wrong data type, e.g. a quoted number.
  • An enum value that is not in the allowed list.
  • Nullable differences between OpenAPI 3.0 (nullable: true) and JSON Schema (type: [..., "null"]).
  • Assuming an OpenAPI Schema Object behaves identically to full JSON Schema in every keyword.

Related tools

Related guides

FAQ

Can I validate OpenAPI examples against schema?

Yes. Paste the Schema Object and the example payload; the validator reports whether the example satisfies the schema.

Is OpenAPI schema the same as JSON Schema?

Largely. OpenAPI 3.x Schema Objects are based on JSON Schema, with a few differences such as nullable: true in 3.0 and some keyword handling.

How do I check required fields?

List them in the schema's required array. The validator flags any listed field that is missing from the example.

Why does my enum validation fail?

The value is not in the allowed list. Enum matching is exact and case-sensitive, so enabled fails an enum of active and inactive.

Can I validate response examples locally?

Yes. Validation runs in your browser with Ajv; nothing is sent to a server.

Schema validation runs locally in your browser using Ajv. No JSON is uploaded.

Explore more JSON and API contract tools

Schema validation, JSON Patch, JSON diff and JSONPath testing — grouped in one place.

View the JSON & API contract toolkit →