Class AvroUtils
Avro utilities
Inherited Members
Namespace: Confluent.SchemaRegistry.Serdes
Assembly: Confluent.SchemaRegistry.Serdes.Avro.dll
Syntax
public static class AvroUtils
Methods
ResolveNamedSchema(Schema, ISchemaRegistryClient)
Resolves named schemas referenced by the provided schema recursively.
Declaration
public static Task<SchemaNames> ResolveNamedSchema(Schema schema, ISchemaRegistryClient schemaRegistryClient)
Parameters
| Type | Name | Description |
|---|---|---|
| Schema | schema | Schema to resolve named schemas for. |
| ISchemaRegistryClient | schemaRegistryClient | SchemaRegistryClient to use for retrieval. |
Returns
| Type | Description |
|---|---|
| Task<SchemaNames> | A SchemaNames object containing the resolved named schemas. |
Transform(RuleContext, Schema, object, IFieldTransform)
Declaration
public static Task<object> Transform(RuleContext ctx, Schema schema, object message, IFieldTransform fieldTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| RuleContext | ctx | |
| Schema | schema | |
| object | message | |
| IFieldTransform | fieldTransform |
Returns
| Type | Description |
|---|---|
| Task<object> |
Validate(IValidationRuleExecutor, Schema, object, bool)
Walks the message against the schema, evaluating every inline "confluent:rules" CHECK constraint encountered and collecting all failures. Read-only — the message is not modified.
Two kinds of rules are evaluated:
- Record-level ("confluent:rules" on a record schema) —
thisis the record. - Field-level ("confluent:rules" on a record's field) —
thisis the field value. Honors the skip-on-null contract: a field whose value is null does not have its rules invoked.
Failures are returned with their dotted-path location (e.g. addr.zip, tags[3], scores["foo"]). The walk continues after each failure so callers see the full set rather than only the first, unless failFast is set.
Declaration
public static Task<IList<ValidationRuleError>> Validate(IValidationRuleExecutor executor, Schema schema, object message, bool failFast)
Parameters
| Type | Name | Description |
|---|---|---|
| IValidationRuleExecutor | executor | |
| Schema | schema | |
| object | message | |
| bool | failFast |
Returns
| Type | Description |
|---|---|
| Task<IList<ValidationRuleError>> |