Skip to main content

IRtSerializer

Namespace: Meshmakers.Octo.Runtime.Contracts.Serialization

Interface for a serializer for the runtime model

public interface IRtSerializer

Methods

SerializeAsync(StreamWriter, RtModelRootDto)

Serializes the model to the stream.

Task SerializeAsync(StreamWriter streamWriter, RtModelRootDto modelRootDto)

Parameters

streamWriter StreamWriter
A stream ready to write used for serialization

modelRootDto RtModelRootDto
Model to serialize

Returns

Task

DeserializeStreamAsync(Stream, Nullable<CancellationToken>)

Deserializes the runtime model from the stream, optimized for huge files.

Task<IRtDeserializeStream> DeserializeStreamAsync(Stream stream, Nullable<CancellationToken> cancellationToken)

Parameters

stream Stream
The stream to read

cancellationToken Nullable<CancellationToken>
Token to cancel the operation

Returns

Task<IRtDeserializeStream>
The deserialized object. Please check the for validation issues in operationResult.

Remarks:

This method bypasses the schema validation because of huge file size and currently there is no way to validate the JSON schema in a streaming way (without commercial libraries)

DeserializeAsync(Stream, String, OperationResult)

Deserializes the runtime model from the stream.

Task<RtModelRootDto> DeserializeAsync(Stream stream, string locationReference, OperationResult operationResult)

Parameters

stream Stream
The stream to read

locationReference String
A reference used in messages to signal the position of a file or resource

operationResult OperationResult
A operation result object that lists all validation issues. In case of exceptions this object contains the validation errors too.

Returns

Task<RtModelRootDto>

DeserializeAsync(String, String, OperationResult)

Deserializes the runtime model from a string.

Task<RtModelRootDto> DeserializeAsync(string s, string locationReference, OperationResult operationResult)

Parameters

s String
The text containing the runtime model to read

locationReference String
A reference used in messages to signal the position of a file or resource

operationResult OperationResult
A operation result object that lists all validation issues. In case of exceptions this object contains the validation errors too.

Returns

Task<RtModelRootDto>
The deserialized object. Please check the for validation issues in operationResult.