Table of Contents

Class JsonSchemaParser

Namespace
Solace.SchemaRegistry.Serdes.JsonSchema
Assembly
Solace.SchemaRegistry.Serdes.JsonSchema.dll

Parser for JSON Schema that converts raw schema bytes into JsonSchemaModel objects.

public class JsonSchemaParser : ISchemaParser<JsonSchemaModel>, ISchemaLocationReader<JsonSchemaModel>
Inheritance
JsonSchemaParser
Implements
Inherited Members

Remarks

This class implements the ISchemaParser<S> interface for JSON Schemas, providing functionality to parse raw schema bytes into Schema objects. It handles schema references and supports JSON Schema Draft 7.

Properties

ArtifactType

Gets the artifact type identifier for JSON Schema.

public string ArtifactType { get; }

Property Value

string

Always returns "JSON" to identify this parser as handling JSON Schema artifacts.

Methods

GetSchemaFromLocation(string)

Reads and parses a JSON Schema from the specified file location.

public IParsedSchema<JsonSchemaModel> GetSchemaFromLocation(string location)

Parameters

location string

The file path to the JSON Schema resource

Returns

IParsedSchema<JsonSchemaModel>

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

Exceptions

ArgumentNullException

Thrown when location is null

SerializationException

Thrown when the schema file cannot be found, read, or parsed

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

Parses raw schema bytes into a strongly-typed JsonSchemaModel object.

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

Parameters

rawSchema byte[]

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

references IDictionary<string, byte[]>

A dictionary of schema references

Returns

IParsedSchema<JsonSchemaModel>

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

Exceptions

SerializationException

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

See Also