Skip to content

Schema Registry

The schema registry extension provides centralized schema management for job types. Register JSON Schemas for each job type version, enabling validation at enqueue time and breaking change detection during schema evolution.

MethodPathDescription
PUT/ojs/v1/admin/schemas/{type}/{version}Register a schema
GET/ojs/v1/admin/schemas/{type}Get latest schema
GET/ojs/v1/admin/schemas/{type}/{version}Get specific version
GET/ojs/v1/admin/schemas/{type}/versionsList all versions
DELETE/ojs/v1/admin/schemas/{type}/{version}Delete a version
PUT /ojs/v1/admin/schemas/email.send/2
Content-Type: application/json
{
"schema": {
"type": "array",
"items": [
{ "type": "string", "description": "recipient email" },
{
"type": "object",
"properties": {
"subject": { "type": "string" },
"template": { "type": "string" }
},
"required": ["subject"]
}
],
"minItems": 2
}
}

Returns 201 on success. Returns 409 Conflict if the same type/version is already registered with a different schema.

GET /ojs/v1/admin/schemas/email.send

Returns the most recent version registered for the type.

GET /ojs/v1/admin/schemas/email.send/versions

Returns all registered versions for the type, sorted newest first.

Backends can operate in different validation modes:

ModeBehavior
strictReject jobs that don’t match the schema (returns 400)
warnAccept the job but log a validation warning
offNo validation (default)

When registering a new version, the registry can detect breaking changes:

  • Adding required fields → breaking (major version bump)
  • Removing fields → breaking
  • Changing field types → breaking
  • Adding optional fields → non-breaking (minor version bump)

The Redis backend has the most complete schema registry implementation. Other backends support basic schema storage. See the Backend Parity Matrix for details.

The ext-schema-registry conformance suite validates schema operations:

TestDescription
EXT-SCH-001Register a schema
EXT-SCH-002Get latest schema
EXT-SCH-003Get non-existent schema returns 404
EXT-SCH-004List versions
EXT-SCH-005Delete a schema
EXT-SCH-006Duplicate registration returns 409
EXT-SCH-007Get specific version
EXT-SCH-008Delete non-existent returns 404
EXT-SCH-009Empty body returns 400
EXT-SCH-010Latest updates after delete
EXT-SCH-011Complex schema preserved
EXT-SCH-012List versions for non-existent type