Table of Contents

Interface ISchemaParser<S>

Namespace
Solace.SchemaRegistry.Serdes.Core.Resolver
Assembly
Solace.SchemaRegistry.Serdes.Core.dll

Defines a contract for parsing and validating schemas of type S for use in serialization/deserialization operations. This interface provides format-specific schema parsing capabilities for different schema types such as AVRO, JSON Schema, and other structured data formats.

public interface ISchemaParser<S>

Type Parameters

S

The schema type that this parser can handle (e.g., Avro.Schema, JsonSchema)

Remarks

Implementations of this interface are responsible for converting raw schema bytes into strongly-typed schema objects that can be used for validation and serialization operations. The parser handles format-specific parsing logic and schema reference resolution.

Schema parsers are typically registered with schema resolvers and used during the schema resolution process to convert stored schema artifacts into usable schema instances.

Properties

ArtifactType

Gets the artifact type identifier that this parser can handle.

string ArtifactType { get; }

Property Value

string

A string identifier that uniquely identifies the schema format type handled by this parser (e.g., "AVRO", "JSON"). This value is used by schema registries to match artifacts with appropriate parsers.

Remarks

The artifact type serves as a discriminator to determine which parser should be used for a particular schema artifact. This allows schema resolvers to automatically select the correct parser based on the artifact's declared type.

Implementations should return a consistent, case-sensitive string that matches the artifact type used in the schema registry for this format.

Methods

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

Parses the specified raw schema bytes into a strongly-typed parsed schema object, resolving any schema references as needed.

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

Parameters

rawSchema byte[]

The raw schema bytes to parse, typically in a format-specific encoding

references IDictionary<string, byte[]>

A dictionary of schema references where keys are reference names and values are the referenced schema bytes

Returns

IParsedSchema<S>

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

Remarks

This method performs format-specific parsing of schema bytes into a usable schema object. The parsing process may involve validation, reference resolution, and type checking depending on the schema format implementation.

Schema references allow for modular schema design where schemas can reference other schemas. The references dictionary provides the raw bytes for referenced schemas that may be needed during the parsing process.

Exceptions

FormatException

Thrown when the raw schema bytes are not in a valid format for this parser

ArgumentException

Thrown when schema references are invalid or cannot be resolved

SerializationException

Thrown when the schema cannot be parsed due to validation errors

See Also