Schema Registry¶
PatternOps provides two specialised schema registry sub-capabilities for managing schema definitions, versions, and compatibility.
Two Registries¶
| Registry | Package | Use Case |
|---|---|---|
| Messaging | capabilities.schema |
Kafka-style subject/version schemas |
| General | capabilities.schema |
Datasets, APIs, configs, any structured data |
Messaging Schema Registry¶
Kafka-style schema management with subject-based versioning:
public interface MessagingSchemaRegistryContract extends BaseProviderContract {
RegistrationResult registerSchema(String subject, Object schema, String format);
Object getSchema(String subject, int version);
Object getLatestSchema(String subject);
CompatibilityVerdict checkCompatibility(String subject, Object proposedSchema);
List<String> listSubjects();
List<Integer> listVersions(String subject);
void deleteSubject(String subject);
}
Schema Formats¶
| Format | Description |
|---|---|
avro |
Apache Avro schemas |
json_schema |
JSON Schema |
protobuf |
Protocol Buffers |
custom |
Organisation-specific format |
Compatibility Modes¶
| Mode | Rule |
|---|---|
BACKWARD |
New schema can read data written by old schema |
FORWARD |
Old schema can read data written by new schema |
FULL |
Both backward and forward compatible |
NONE |
No compatibility checks |
General Schema Registry¶
For datasets, APIs, and configuration schemas:
public interface GeneralSchemaRegistryContract extends BaseProviderContract {
RegistrationResult registerSchema(String namespace, String name, Object schema, String format);
Object getSchema(String namespace, String name, int version);
Object getLatestSchema(String namespace, String name);
EvolutionResult evolveSchema(String namespace, String name, Object proposed, String strategy);
List<SchemaDescriptor> listSchemas(String namespace);
SchemaDiff compareVersions(String namespace, String name, int versionA, int versionB);
void deprecateSchema(String namespace, String name, int version);
}
Schema Evolution¶
EvolutionResult result = registry.evolveSchema(
"production", "customer-orders",
newSchema, "BACKWARD"
);
// result indicates: compatible, backward-compatible, or breaking
Version Comparison¶
SchemaDiff diff = registry.compareVersions(
"production", "customer-orders", 1, 2
);
// diff.added() → new fields
// diff.removed() → removed fields
// diff.modified() → changed fields
Example Providers¶
| Provider | Type |
|---|---|
| Confluent Schema Registry | Messaging |
| AWS Glue Schema Registry | Messaging + General |
| Custom Database-backed | General |
Integration with Data Contracts¶
Schema Registry works alongside Data Contracts:
- Data Contract defines the agreement (schema + quality + SLA)
- Schema Registry manages the schema versions and compatibility
- Echo Service tracks contract history and publishes changes