APISchema
Cloudflare’s API Gateway Schema resource allows you to upload and manage OpenAPI v3 schemas for API validation. These schemas define the structure and validation rules for your API endpoints, enabling Cloudflare to validate incoming requests against your API specification.
Basic Schema Upload
Section titled “Basic Schema Upload”Upload an OpenAPI v3 schema to enable API validation for your zone:
import { APISchema, Zone } from "alchemy/cloudflare";
const zone = await Zone("example.com");
const apiSchema = await APISchema("my-api-schema", { zone, name: "my-api-v1", schema: { openapi: "3.0.0", info: { title: "My API", version: "1.0.0" }, servers: [ { url: "https://api.example.com" } ], paths: { "/users": { get: { operationId: "getUsers", responses: { "200": { description: "Success" } } } } } }});