ApiShieldUserSchema
Source:
src/Cloudflare/ApiShield/UserSchema.ts
A Cloudflare API Shield user schema — an OpenAPI v3 document uploaded to a zone for (legacy “classic”) schema validation of API traffic.
An uploaded schema’s contents cannot be modified, so changing the
schema source (or the name) triggers a replacement. The only in-place
update is enabling validation; Cloudflare forbids disabling an enabled
schema, so turning validation back off also triggers a replacement.
For current zone-level schema validation (v2), prefer the
Cloudflare.SchemaValidation resources.
Uploading a Schema
Section titled “Uploading a Schema”Upload an OpenAPI v3 schema
const fs = yield* FileSystem.FileSystem;const source = yield* fs.readFileString("./openapi.json");
const schema = yield* Cloudflare.ApiShieldUserSchema("PetstoreSchema", { zoneId: zone.zoneId, name: "petstore", schema: source,});// schema.schemaId is the Cloudflare-assigned UUIDUpload and enable validation
yield* Cloudflare.ApiShieldUserSchema("PetstoreSchema", { zoneId: zone.zoneId, schema: source, validationEnabled: true,});