Validate JSON data with schemas, types, required fields, formats, composition, and API contracts.
Lessons
Use schemas to define API request and response bodies.
JSON Schema in OpenAPI is easiest to learn by reading the example, changing it, and observing the result.
# OpenAPI uses JSON Schema to define request/response bodies
paths:
/lessons:
post:
requestBody:
content:
application/json:
schema:
type: object
required: [slug, title]
properties:
slug: { type: string }
title: { type: string, minLength: 3 }Practice the JSON Schema in OpenAPI example in a small scratch file, then explain what changed and why.