java.lang.Object
io.confluent.kafka.schemaregistry.type.logical.Rule

public final class Rule extends Object
A validation rule attached to a Schema or Schema.Field, authored as a SQL-flavored CHECK (...) clause and translated to a CEL expression for runtime evaluation.

Mirrors the Meta.Rule doc in confluent/meta.proto so the wire form is uniform across Avro/JSON (as a confluent:rules array property) and Protobuf (as a repeated Rule rules field on Meta).

Field semantics:

  • getName() — optional machine identifier from CONSTRAINT name CHECK (...); null if the user didn't supply one. Used in error reporting.
  • getDoc() — optional human-readable error text from MESSAGE 'text'; null if absent. Surfaced when the rule fails at runtime.
  • getExpr() — the translated CEL expression that the runtime evaluator executes. Always non-null.
  • getSql() — the original SQL CHECK expression text. Used by the DDL emitter to round-trip back to readable SQL. Always non-null. Named sql to match the existing convention in Meta.Rule that distinguishes "sql-form source" from the "expression form" stored in expr.

The expr field is the source of truth for runtime evaluation; sql is the source of truth for DDL re-emission.