Class JsonSchemaDeserializer<T>
- Namespace
- Solace.SchemaRegistry.Serdes.JsonSchema
- Assembly
- Solace.SchemaRegistry.Serdes.JsonSchema.dll
A deserializer for JSON Schema-formatted data that converts byte arrays into objects of type T. This class extends AbstractDeserializer<Schema, T> and implements the deserialization logic specific to JSON schemas. Returns a specific target object of type T or a JSON object when the target deserialized type cannot be determined.
public class JsonSchemaDeserializer<T> : AbstractDeserializer<JsonSchemaModel, T>, IAsyncDeserializer<T>, IDisposable
Type Parameters
TThe type of object this deserializer produces.
- Inheritance
-
JsonSchemaDeserializer<T>
- Implements
-
IAsyncDeserializer<T>
- Inherited Members
Remarks
JsonSchemaDeserializer<T> requires schema resolution through headers for proper operation. Schema ID must be available during deserialization to resolve the payload schema.
Note: This deserializer establishes connections that may prevent application exit. Always call Dispose() when finished to properly clean up resources.
Methods
Configure(IDictionary<string, object>)
Configures this deserializer with the specified properties.
public override void Configure(IDictionary<string, object> properties)
Parameters
propertiesIDictionary<string, object>A dictionary containing configuration properties for the deserializer
DeserializePayload(ISchemaLookupResult<JsonSchemaModel>, ReadOnlyMemory<byte>, IMetadata, CancellationToken)
Deserializes the payload data using the resolved JSON schema.
protected override ValueTask<T> DeserializePayload(ISchemaLookupResult<JsonSchemaModel> schemaLookup, ReadOnlyMemory<byte> payload, IMetadata metadata, CancellationToken token)
Parameters
schemaLookupISchemaLookupResult<JsonSchemaModel>The resolved schema lookup result containing the JSON schema
payloadReadOnlyMemory<byte>The byte array payload to deserialize
metadataIMetadataMetadata containing the destination name and headers for the deserialization context
tokenCancellationTokenCancellation token for the operation
Returns
- ValueTask<T>
The deserialized object of type T
Exceptions
- JsonSchemaValidationException
Thrown when JSON schema validation fails
- SerializationException
Thrown when deserialization fails
- OperationCanceledException
Thrown when the operation is canceled via the cancellation token