Contract-First API Design

API Gateway Proxy
Schema Validation

Validate API requests and responses against JSON Schema and OpenAPI specifications. Catch errors early with detailed validation reporting.

"type" : "object"
"required" : ["name", "email"]
"properties" : {...}
"additionalProps" : false

Schema Validation Standards

Choose the right schema standard for your API gateway

📄
JSON Schema
IETF standard for JSON document validation with rich type system.
  • Type checking (string, number, array)
  • Required field validation
  • Pattern matching with regex
  • Nested object support
  • Custom error messages
📜
OpenAPI 3.0/3.1
Full API specification with request/response validation.
  • Endpoint definitions
  • HTTP method validation
  • Parameter constraints
  • Response schema enforcement
  • Security scheme support
📚
AsyncAPI
Event-driven API schema validation for streaming.
  • WebSocket message validation
  • Kafka event schemas
  • Channel definitions
  • Publish/subscribe patterns
  • Real-time streaming

Schema Examples

Common validation patterns for API gateway proxies

📄 JSON Schema for User Draft-07
{
  "$schema": "https://json-schema.org/draft-07/schema",
  "$id": "https://api.example.com/schemas/user",
  "type": "object",
  "required": ["name", "email"],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "integer",
      "minimum": 0,
      "maximum": 150
    }
  },
  "additionalProperties": false
}
📜 OpenAPI 3.0 Endpoint OAS3
"paths": { "/v1/chat/completions": { "post": { "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["model", "messages"], "properties": { "model": { "type": "string", "enum": ["gpt-4", "gpt-3.5-turbo"] }, "messages": { "type": "array", "items": { "$ref": "#/components/schemas/Message" } } } } } } } } } } }

Feature Comparison

Choose the right validation approach for your needs

Feature JSON Schema OpenAPI AsyncAPI
Type Validation
Required Fields
HTTP Method Routing
Response Validation
Streaming Support
Security Schemes
Documentation Gen