Skip to main content

user_schemas

Creates, updates, deletes, gets or lists a user_schemas resource.

Overview

Nameuser_schemas
TypeResource
Idcloudflare.api_gateway.user_schemas

Fields

The following fields are returned by SELECT queries:

Retrieve information about a specific schema on a zone response

NameDatatypeDescription
namestringName of the schema (example: petstore schema)
schema_idstringUUID. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
kindstringKind of schema (openapi_v3) (example: openapi_v3)
sourcestringSource of the schema (example: <schema file bytes>)
validation_enabledbooleanFlag whether schema is enabled for validation.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectzone_id, schema_idomit_sourceGets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration.
listselectzone_idpage, per_page, omit_source, validation_enabledLists all OpenAPI schemas uploaded to API Shield for the zone, including their validation status and associated operations.
createinsertzone_id, file, kind
editupdatezone_id, schema_idActivates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions.
deletedeletezone_id, schema_idPermanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
schema_idstring (uuid)Identifier for the schema-ID
zone_idstringThe Cloudflare zone ID.
omit_sourcebooleanOmit the source-files of schemas and only retrieve their meta-data.
pageintegerPage number of paginated results.
per_pageintegerMaximum number of results per page.
validation_enabledboolean

SELECT examples

Gets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration.

SELECT
name,
schema_id,
created_at,
kind,
source,
validation_enabled
FROM cloudflare.api_gateway.user_schemas
WHERE zone_id = '{{ zone_id }}' -- required
AND schema_id = '{{ schema_id }}' -- required
AND omit_source = '{{ omit_source }}'
;

INSERT examples

No description available.

INSERT INTO cloudflare.api_gateway.user_schemas (
file,
kind,
name,
validation_enabled,
zone_id
)
SELECT
'{{ file }}' /* required */,
'{{ kind }}' /* required */,
'{{ name }}',
'{{ validation_enabled }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Activates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions.

UPDATE cloudflare.api_gateway.user_schemas
SET
validation_enabled = {{ validation_enabled }}
WHERE
zone_id = '{{ zone_id }}' --required
AND schema_id = '{{ schema_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Permanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules.

DELETE FROM cloudflare.api_gateway.user_schemas
WHERE zone_id = '{{ zone_id }}' --required
AND schema_id = '{{ schema_id }}' --required
;