JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It provides a contract for your JSON data, defining the structure, data types, and validation rules.Apidog uses JSON Schema to define request and response body structures, enabling automatic validation and documentation generation for your APIs.This page provides a brief introduction to JSON Schema. For complete specification details, syntax, and advanced features, refer to the official JSON Schema Documentation. What is JSON Schema?#
JSON Schema is a powerful tool for:Validating JSON data against defined rules
Documenting expected JSON structure
Generating mock data based on schema definitions
Ensuring consistency across API requests and responses
Common Use Cases#
Define request body schemas for POST/PUT/PATCH endpoints
Specify response body structures for all HTTP methods
Validate incoming data against expected formats
Generate mock responses automatically
Create comprehensive API documentation
Learn More#
Start with simple schemas defining basic types and required fields, then gradually add validation rules and constraints as needed.