Fastify · Schema
Fastify Route Schema Definition
JSON Schema for Fastify route schema definitions used for request validation and response serialization.
FrameworksHigh PerformanceJavaScriptJSON-SchemaNode.jsTypeScript
Properties
| Name | Type | Description |
|---|---|---|
| method | object | HTTP method(s) for the route. |
| url | string | Route URL path (e.g., /api/users/:id). |
| schema | object | Schema definitions for request validation and response serialization. |
| attachValidation | boolean | Attach validation errors to the request instead of sending 400. |
| exposeHeadRoute | boolean | Automatically create a HEAD route for GET routes. |
| prefixTrailingSlash | string | How to handle trailing slashes when a prefix is set. |
| bodyLimit | integer | Maximum allowed body size for this route in bytes. |
| logLevel | string | Route-specific log level. |
| config | object | Custom route-level configuration. |
| constraints | object | Custom route constraints (e.g., version, host). |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/api-evangelist/fastify/json-schema/fastify-route-schema.json",
"title": "Fastify Route Schema Definition",
"description": "JSON Schema for Fastify route schema definitions used for request validation and response serialization.",
"type": "object",
"properties": {
"method": {
"description": "HTTP method(s) for the route.",
"oneOf": [
{
"type": "string",
"enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
},
{
"type": "array",
"items": {
"type": "string",
"enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
}
}
]
},
"url": {
"type": "string",
"description": "Route URL path (e.g., /api/users/:id)."
},
"schema": {
"type": "object",
"description": "Schema definitions for request validation and response serialization.",
"properties": {
"body": {
"type": "object",
"description": "JSON Schema for request body validation.",
"additionalProperties": true
},
"querystring": {
"type": "object",
"description": "JSON Schema for query string parameter validation.",
"additionalProperties": true
},
"params": {
"type": "object",
"description": "JSON Schema for URL parameter validation.",
"additionalProperties": true
},
"headers": {
"type": "object",
"description": "JSON Schema for request header validation.",
"additionalProperties": true
},
"response": {
"type": "object",
"description": "Response schemas keyed by HTTP status code for serialization.",
"patternProperties": {
"^[1-5][0-9]{2}$": {
"type": "object",
"description": "JSON Schema for response body at this status code.",
"additionalProperties": true
},
"^2xx$": {
"type": "object",
"description": "JSON Schema for all 2xx responses.",
"additionalProperties": true
}
},
"additionalProperties": true
},
"tags": {
"type": "array",
"description": "OpenAPI tags for documentation.",
"items": {
"type": "string"
}
},
"summary": {
"type": "string",
"description": "OpenAPI summary for the route."
},
"description": {
"type": "string",
"description": "OpenAPI description for the route."
},
"consumes": {
"type": "array",
"description": "Accepted content types.",
"items": {
"type": "string"
}
},
"produces": {
"type": "array",
"description": "Produced content types.",
"items": {
"type": "string"
}
},
"security": {
"type": "array",
"description": "OpenAPI security requirements.",
"items": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": { "type": "string" }
}
}
}
},
"additionalProperties": true
},
"attachValidation": {
"type": "boolean",
"description": "Attach validation errors to the request instead of sending 400.",
"default": false
},
"exposeHeadRoute": {
"type": "boolean",
"description": "Automatically create a HEAD route for GET routes.",
"default": true
},
"prefixTrailingSlash": {
"type": "string",
"description": "How to handle trailing slashes when a prefix is set.",
"enum": ["slash", "no-slash", "both"],
"default": "both"
},
"bodyLimit": {
"type": "integer",
"description": "Maximum allowed body size for this route in bytes."
},
"logLevel": {
"type": "string",
"description": "Route-specific log level.",
"enum": ["trace", "debug", "info", "warn", "error", "fatal", "silent"]
},
"config": {
"type": "object",
"description": "Custom route-level configuration.",
"additionalProperties": true
},
"constraints": {
"type": "object",
"description": "Custom route constraints (e.g., version, host).",
"properties": {
"version": {
"type": "string",
"description": "Version constraint for content-type versioning."
},
"host": {
"type": "string",
"description": "Host constraint for virtual hosting."
}
},
"additionalProperties": true
}
},
"required": ["method", "url"],
"additionalProperties": true
}
Work with this as data
Every JSON Schema here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for schemas
4 MCP tools reach this
find_json_schemasBrowse and filter every JSON Schema in the catalog.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.
Call it yourself
curl for this page
This JSON Schema
curl "https://apis.io/api/v1/json-schemas/fastify-route"
All schemas
curl "https://apis.io/api/v1/json-schemas?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.