Table of Contents

Class JsonSchemaProperties

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

A class for configuring JSON schema properties. This is used by JsonSchemaSerializer<T> and JsonSchemaDeserializer<T>.

public class JsonSchemaProperties : SerdeProperties
Inheritance
JsonSchemaProperties
Inherited Members

Remarks

This class extends SerdeProperties and provides JSON Schema-specific configuration options including validation settings and type property configuration for deserialization.

Constructors

JsonSchemaProperties(IDictionary<string, object>)

Initializes a new instance of the JsonSchemaProperties class with the specified configuration dictionary.

protected JsonSchemaProperties(IDictionary<string, object> configuration)

Parameters

configuration IDictionary<string, object>

A dictionary containing configuration key-value pairs. Required properties must be provided.

Exceptions

ArgumentNullException

Thrown when configuration is null

Properties

TypeProperty

Gets the JSON schema property name that contains the .NET type class path for deserialization. The JsonSchemaDeserializer<T> uses this JSON schema property to determine the target .NET class when deserializing. The default value is "dotnetType".

public string TypeProperty { get; }

Property Value

string
See Also

ValidateSchema

Gets a value indicating whether JSON schema validation is enabled during serialization and deserialization. When enabled, data is validated against the resolved JSON schema before serialization or after deserialization, and a JsonSchemaValidationException is thrown if validation fails. The default value is true.

public bool ValidateSchema { get; }

Property Value

bool
See Also

ValidationErrorHandler

Gets the validation error handler configured for the serializer/deserializer. When set, validation errors are passed to this handler which returns a JsonSchemaValidationException to throw, or null to suppress the error and continue serialization. If no handler is configured, the default behavior is to throw a JsonSchemaValidationException.

public Func<JsonValidationErrorArgs, JsonSchemaValidationException> ValidationErrorHandler { get; }

Property Value

Func<JsonValidationErrorArgs, JsonSchemaValidationException>

Remarks

Warning: The handler is invoked synchronously on the serialization thread. Avoid performing long-running or blocking operations (e.g., network calls, file I/O) inside the handler, as this will block serialization until the handler returns.

If the handler itself throws an exception (rather than returning one), it will be caught and wrapped in a Solace.Serdes.SerializationException.

See Also

Methods

FromDictionary(IDictionary<string, object>)

Creates a new JsonSchemaProperties instance with the specified configuration.

public static JsonSchemaProperties FromDictionary(IDictionary<string, object> configuration)

Parameters

configuration IDictionary<string, object>

A dictionary containing configuration key-value pairs. Required properties must be provided.

Returns

JsonSchemaProperties

A fully initialized JsonSchemaProperties instance.

Exceptions

ArgumentNullException

Thrown when configuration is null

ArgumentException

Thrown when the configuration contains invalid keys or values, or required properties are missing

GetDefaults()

Gets a copy of the default JsonSchemaProperties properties. This contains defaults defined in SerdeProperties.

protected override IDictionary<string, object> GetDefaults()

Returns

IDictionary<string, object>

A copy of the default set properties.

LoadFromConfig()

Loads JSON Schema-specific configuration values into properties. Called during construction. Calls base implementation first.

protected override void LoadFromConfig()

See Also