📋

JSON Schema Builder

Verified

by Community

Builds JSON Schema documents for validating API payloads, configuration files, and data interchange formats with proper type definitions, constraints, conditional validation, and schema composition.

json-schemavalidationapidatadocumentation

JSON Schema Builder

Builds JSON Schema documents (Draft 2020-12) for validating API request/response payloads, configuration files, and data interchange formats. Covers type definitions, string format validation, numeric constraints, array item validation, object property rules, required fields, conditional schemas (if/then/else), composition (allOf, anyOf, oneOf), $ref references, and custom format definitions.

Usage

Describe the JSON data structure you need to validate, including field types, constraints, required fields, and any conditional rules. Specify whether the schema is for API validation, configuration files, or data exchange. The skill generates a complete JSON Schema with $defs for reusable types and descriptive annotations.

Examples

  • "Create a JSON Schema for a user registration payload with email validation, password rules, and optional profile"
  • "Build a schema for a configuration file with environment-specific settings and conditional required fields"
  • "Design a schema for an event payload with discriminated union types (order_created, order_shipped, order_cancelled)"
  • "Create a reusable address schema with country-specific validation (US zip code vs UK postcode)"

Guidelines

  • Use $defs (formerly definitions) for reusable type definitions referenced with $ref throughout the schema
  • Add description to every property for self-documenting schemas that generate useful API documentation
  • Use format keyword for standard validations: email, uri, date-time, uuid, ipv4 — but note not all validators enforce format
  • Prefer oneOf with discriminator for union types to provide clear error messages about which variant failed
  • Use additionalProperties: false to reject unexpected fields and catch typos in property names
  • Set minimum, maximum, minLength, maxLength, pattern constraints to validate at the schema level
  • Use if/then/else for conditional validation rules that depend on the value of another field
  • Use examples and default values in the schema to improve documentation and developer experience