confluent-kafka-dotnet
Show / Hide Table of Contents

Class AvroUtils

Avro utilities

Inheritance
object
AvroUtils
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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) — this is the record.
  • Field-level ("confluent:rules" on a record's field) — this is 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>>
In this article