Table of Contents

Class AvroSchemaParser<T>

Namespace
Solace.SchemaRegistry.Serdes.Avro
Assembly
Solace.SchemaRegistry.Serdes.Avro.dll

Parser for AVRO schemas that converts raw schema bytes into Avro.Schema objects.

public class AvroSchemaParser<T> : ISchemaParser<Schema>, ISchemaDataReader<Schema, T>

Type Parameters

T

The type of the record data from which a schema can be derived

Inheritance
AvroSchemaParser<T>
Implements
Inherited Members

Remarks

This class implements the ISchemaParser<S> interface for AVRO schemas, providing functionality to parse raw schema bytes into Avro.Schema objects.

Properties

ArtifactType

Gets the artifact type identifier for AVRO.

public string ArtifactType { get; }

Property Value

string

Always returns "AVRO" to identify this parser as handling AVRO artifacts.

Methods

GetSchemaFromData(IRecord<T>)

Reads and parses the AVRO schema from the specified record data.

public IParsedSchema<Schema> GetSchemaFromData(IRecord<T> record)

Parameters

record IRecord<T>

The record whose value is an AVRO primitive, an Avro.Specific.ISpecificRecord, or a Avro.Generic.GenericRecord

Returns

IParsedSchema<Schema>

An IParsedSchema<S> containing the parsed schema and raw schema bytes

Exceptions

ArgumentNullException

Thrown when record is null

SerializationException

Thrown when the record value is not an AVRO primitive, an Avro.Specific.ISpecificRecord, or a Avro.Generic.GenericRecord, or when the value is null and T is not object

Parse(byte[], IDictionary<string, byte[]>)

Parses raw schema bytes into a strongly-typed Avro.Schema object.

public IParsedSchema<Schema> Parse(byte[] rawSchema, IDictionary<string, byte[]> references)

Parameters

rawSchema byte[]

The raw schema bytes to parse, encoded as UTF-8 AVRO

references IDictionary<string, byte[]>

A dictionary mapping reference names to their raw schema bytes. References are pre-registered into a shared Avro.SchemaNames context before the main schema is parsed, enabling cross-schema named type resolution. For simple linear reference chains the dictionary values are parsed in reverse insertion order so that leaf schemas (which have no dependencies) are registered first.

Returns

IParsedSchema<Schema>

An IParsedSchema<S> instance containing the parsed Avro.Schema object and raw schema data.

Exceptions

ArgumentNullException

Thrown when rawSchema is null

SerializationException

Thrown when the schema cannot be parsed due to invalid or empty AVRO format

See Also