StellaOps.Workflow.Contracts.Durability

Durable execution contracts of the workflow engine: the durable start and activity contracts, RFC 8785 canonical JSON with its SHA-256 digest, a strict JSON reader, bounded scalar types and a frozen JSON schema set.

PackageStellaOps.Workflow.Contracts.Durability
ComponentWorkflow
LicenceBUSL-1.1 (Workflow licence)
Package kindLibrary
Target frameworknet10.0

To add the package to a project, see Installing Stella Ops packages.

Namespaces

NamespaceTypes
StellaOps.Workflow.Contracts.Durability.Activities9
StellaOps.Workflow.Contracts.Durability.CanonicalJson7
StellaOps.Workflow.Contracts.Durability.Execution5
StellaOps.Workflow.Contracts.Durability.Payloads4
StellaOps.Workflow.Contracts.Durability.Scalars14
StellaOps.Workflow.Contracts.Durability.Schemas3
StellaOps.Workflow.Contracts.Durability.Serialization2
StellaOps.Workflow.Contracts.Durability.Validation3

StellaOps.Workflow.Contracts.Durability.Activities namespace

TypeKindDescription
WorkflowActivityCancelActiveAttemptV1recordThe attempt a cancel stops.
WorkflowActivityCancelContinuationLineageV1recordThe continuation a cancel revokes.
WorkflowActivityCancelV1recordSent on the cancel lane when an operator or a deadline stops a step whose attempt may still run.
WorkflowActivityCompletionContinuationV1recordA continuation the handler reports, for the next attempt to resume.
WorkflowActivityCompletionV1recordThe handler’s answer on the completion lane, bound to the exact request it answers.
WorkflowActivityFailureV1recordWhy an activity attempt failed.
WorkflowActivityOutcomeenumThe outcome of an activity attempt.
WorkflowActivityRequestContinuationV1recordThe continuation a retry resumes: the prior attempt’s completion and its continuation.
WorkflowActivityRequestV1recordThe request an external activity handler receives on its execute lane: the attempt identity the engine fences on, the registered operation, the deadline and the input payload.

WorkflowActivityCancelActiveAttemptV1 record

public sealed record WorkflowActivityCancelActiveAttemptV1 : IContractValidatable

The attempt a cancel stops.

WorkflowActivityCancelActiveAttemptV1() constructor

public WorkflowActivityCancelActiveAttemptV1()

Creates an instance of WorkflowActivityCancelActiveAttemptV1.

AttemptId property

public required string AttemptId { get; init; }

The attempt.

DispatchId property

public required string DispatchId { get; init; }

The dispatch.

RequestSha256 property

public required Sha256Hex RequestSha256 { get; init; }

The SHA-256 of the request.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityCancelContinuationLineageV1 record

public sealed record WorkflowActivityCancelContinuationLineageV1 : IContractValidatable

The continuation a cancel revokes.

WorkflowActivityCancelContinuationLineageV1() constructor

public WorkflowActivityCancelContinuationLineageV1()

Creates an instance of WorkflowActivityCancelContinuationLineageV1.

ContinuationRef property

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

ContinuationSha256 property

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

Generation property

public required long Generation { get; init; }

The continuation generation.

LineageId property

public required string LineageId { get; init; }

The lineage.

SourceAttemptId property

public required string SourceAttemptId { get; init; }

The attempt that left the continuation.

SourceCompletionEventId property

public required string SourceCompletionEventId { get; init; }

The completion that carried it.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityCancelV1 record

public sealed record WorkflowActivityCancelV1 : IContractValidatable

Sent on the cancel lane when an operator or a deadline stops a step whose attempt may still run.

WorkflowActivityCancelV1() constructor

public WorkflowActivityCancelV1()

Creates an instance of WorkflowActivityCancelV1.

ActiveAttempt property

public required WorkflowActivityCancelActiveAttemptV1? ActiveAttempt { get; init; }

The attempt to stop, when one may still run.

CancelFenceVersion property

public required long CancelFenceVersion { get; init; }

The cancel fence of the request.

CancelId property

public required string CancelId { get; init; }

The cancel request.

CanceledAt property

public required Rfc3339MillisecondInstant CanceledAt { get; init; }

When the step was canceled.

ContinuationLineage property

public required WorkflowActivityCancelContinuationLineageV1? ContinuationLineage { get; init; }

The continuation to revoke, when there is one.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

DeadlineAt property

public required Rfc3339MillisecondInstant? DeadlineAt { get; init; }

The deadline that stopped the step, for a deadline cancel.

EventId property

public required string EventId { get; init; }

The event identifier.

ReasonCode property

public required string ReasonCode { get; init; }

Why.

ScopeExecutionId property

public required string ScopeExecutionId { get; init; }

The scope.

StepExecutionId property

public required string StepExecutionId { get; init; }

The step execution.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityCompletionContinuationV1 record

public sealed record WorkflowActivityCompletionContinuationV1 : IContractValidatable

A continuation the handler reports, for the next attempt to resume.

WorkflowActivityCompletionContinuationV1() constructor

public WorkflowActivityCompletionContinuationV1()

Creates an instance of WorkflowActivityCompletionContinuationV1.

ContinuationRef property

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

ContinuationSha256 property

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

Generation property

public required long Generation { get; init; }

The continuation generation.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityCompletionV1 record

public sealed record WorkflowActivityCompletionV1 : IContractValidatable

The handler’s answer on the completion lane, bound to the exact request it answers.

WorkflowActivityCompletionV1() constructor

public WorkflowActivityCompletionV1()

Creates an instance of WorkflowActivityCompletionV1.

AttemptId property

public required string AttemptId { get; init; }

The attempt.

CompletedAt property

public required Rfc3339MillisecondInstant CompletedAt { get; init; }

When the attempt completed.

Continuation property

public required WorkflowActivityCompletionContinuationV1? Continuation { get; init; }

A continuation for the next attempt to resume.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

DispatchId property

public required string DispatchId { get; init; }

The dispatch.

EventId property

public required string EventId { get; init; }

The event identifier.

Failure property

public required WorkflowActivityFailureV1? Failure { get; init; }

Why it failed, for a failure.

OperationCode property

public required string OperationCode { get; init; }

The operation of the activity.

Outcome property

public required WorkflowActivityOutcome Outcome { get; init; }

The outcome.

RequestSha256 property

public required Sha256Hex RequestSha256 { get; init; }

The SHA-256 of the request it answers.

Result property

public required JsonPayloadDescriptorV1? Result { get; init; }

The result payload, for a success.

ScopeExecutionId property

public required string ScopeExecutionId { get; init; }

The scope.

StepExecutionId property

public required string StepExecutionId { get; init; }

The step execution.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

Validate() method

public void Validate()

Checks the fields.

Exceptions

ValidateAgainst(WorkflowActivityRequestV1) method

public void ValidateAgainst(WorkflowActivityRequestV1 request)

Checks that the completion answers the request.

Parameters

Exceptions

WorkflowActivityFailureV1 record

public sealed record WorkflowActivityFailureV1 : IContractValidatable

Why an activity attempt failed.

WorkflowActivityFailureV1() constructor

public WorkflowActivityFailureV1()

Creates an instance of WorkflowActivityFailureV1.

Category property

public required string Category { get; init; }

The failure category, which the retry policy matches.

Code property

public required string Code { get; init; }

The failure code.

RetryAfter property

public required Rfc3339MillisecondInstant? RetryAfter { get; init; }

When the provider asks the retry to wait until.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityOutcome enum

public enum WorkflowActivityOutcome

The outcome of an activity attempt.

ValueDescription
SUCCEEDED = 0Succeeded.
RETRYABLE = 1Failed; a retry may succeed.
PERMANENT_FAILURE = 2Failed; a retry would fail too.
CANCELED = 3Canceled.
DEADLINE_EXCEEDED = 4Ran past its deadline.

WorkflowActivityRequestContinuationV1 record

public sealed record WorkflowActivityRequestContinuationV1 : IContractValidatable

The continuation a retry resumes: the prior attempt’s completion and its continuation.

WorkflowActivityRequestContinuationV1() constructor

public WorkflowActivityRequestContinuationV1()

Creates an instance of WorkflowActivityRequestContinuationV1.

ContinuationRef property

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

ContinuationSha256 property

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

Generation property

public required long Generation { get; init; }

The continuation generation.

PriorAttemptId property

public required string PriorAttemptId { get; init; }

The prior attempt.

PriorCompletionEventId property

public required string PriorCompletionEventId { get; init; }

The prior completion.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowActivityRequestV1 record

public sealed record WorkflowActivityRequestV1 : IContractValidatable

The request an external activity handler receives on its execute lane: the attempt identity the engine fences on, the registered operation, the deadline and the input payload. A retry that resumes a pending external operation carries the continuation the prior attempt reported.

WorkflowActivityRequestV1() constructor

public WorkflowActivityRequestV1()

Creates an instance of WorkflowActivityRequestV1.

AttemptId property

public required string AttemptId { get; init; }

The attempt.

Continuation property

public required WorkflowActivityRequestContinuationV1? Continuation { get; init; }

The continuation a retry resumes, when it resumes one.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

DeadlineAt property

public required Rfc3339MillisecondInstant DeadlineAt { get; init; }

The deadline of the attempt.

DispatchId property

public required string DispatchId { get; init; }

The dispatch.

Input property

public required JsonPayloadDescriptorV1 Input { get; init; }

The input payload.

OperationCode property

public required string OperationCode { get; init; }

The operation of the activity.

OperationVersion property

public required string OperationVersion { get; init; }

The operation version.

ScopeExecutionId property

public required string ScopeExecutionId { get; init; }

The scope.

StepExecutionId property

public required string StepExecutionId { get; init; }

The step execution.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

ComputeSha256() method

public Sha256Hex ComputeSha256()

The SHA-256 of the request’s canonical JSON.

Returns

The SHA-256.

Validate() method

public void Validate()

Checks the fields.

Exceptions

ValidateContinuationOf(WorkflowActivityCompletionV1) method

public void ValidateContinuationOf(WorkflowActivityCompletionV1 priorCompletion)

Checks that the request resumes the continuation of a prior completion.

Parameters

Exceptions

StellaOps.Workflow.Contracts.Durability.CanonicalJson namespace

TypeKindDescription
CanonicalJsonErrorCodesclassThe error codes of the strict JSON reader and the canonicalizer.
CanonicalJsonExceptionclassRaised when JSON breaks the strict reading or canonicalization rules; its message carries only the code, the pointer and the limit.
CanonicalJsonResultclassCanonical JSON bytes with their root kind and SHA-256.
StrictJsonReadResultrecordWhat the strict reader saw.
StrictJsonReaderclassReads JSON strictly: UTF-8 without a byte order mark, no duplicate property, strings that decode as Unicode, I-JSON numbers and the reader limits.
StrictJsonReaderOptionsrecordLimits of the strict JSON reader that reads canonical durable JSON; every limit must be positive.
WorkflowJcsV1classThe Workflow JSON canonicalization: strict reading, then RFC 8785 (JCS).

CanonicalJsonErrorCodes class

public static class CanonicalJsonErrorCodes

The error codes of the strict JSON reader and the canonicalizer.

BomNotAllowed constant

public const string BomNotAllowed = "JSON_BOM_NOT_ALLOWED"

The JSON starts with a byte order mark.

CanonicalizationFailed constant

public const string CanonicalizationFailed = "JSON_CANONICALIZATION_FAILED"

The canonicalization failed.

DuplicateProperty constant

public const string DuplicateProperty = "JSON_DUPLICATE_PROPERTY"

An object has the same property twice.

InvalidUnicode constant

public const string InvalidUnicode = "JSON_INVALID_UNICODE"

A string does not decode as Unicode, such as one with an unpaired surrogate.

InvalidUtf8 constant

public const string InvalidUtf8 = "JSON_INVALID_UTF8"

The bytes are not valid UTF-8.

LimitExceeded constant

public const string LimitExceeded = "JSON_LIMIT_EXCEEDED"

A reader limit is exceeded.

NumberNotIJson constant

public const string NumberNotIJson = "JSON_NUMBER_NOT_IJSON"

A number is outside the I-JSON range (RFC 7493).

PayloadHashMismatch constant

public const string PayloadHashMismatch = "PAYLOAD_HASH_MISMATCH"

The canonical SHA-256 differs from the expected one.

PayloadLengthMismatch constant

public const string PayloadLengthMismatch = "PAYLOAD_LENGTH_MISMATCH"

The canonical length differs from the expected one.

SyntaxInvalid constant

public const string SyntaxInvalid = "JSON_SYNTAX_INVALID"

The JSON syntax is not valid.

CanonicalJsonException class

public sealed class CanonicalJsonException : Exception

Raised when JSON breaks the strict reading or canonicalization rules; its message carries only the code, the pointer and the limit.

CanonicalJsonException(string, string, string, Exception) constructor

public CanonicalJsonException(string code, string jsonPointer, string? limitName = null, Exception? innerException = null)

Creates the exception.

Parameters

Code property

public string Code { get; }

The error code.

JsonPointer property

public string JsonPointer { get; }

The JSON pointer of the value.

LimitName property

public string? LimitName { get; }

The limit exceeded, when one was.

CanonicalJsonResult class

public sealed class CanonicalJsonResult

Canonical JSON bytes with their root kind and SHA-256.

ByteLength property

public int ByteLength { get; }

The byte length.

Bytes property

public ReadOnlyMemory<byte> Bytes { get; }

The canonical UTF-8 bytes.

RootKind property

public JsonValueKind RootKind { get; }

The kind of the root value.

Sha256 property

public Sha256Hex Sha256 { get; }

The SHA-256 of the bytes.

GetUtf8String() method

public string GetUtf8String()

Returns the canonical JSON as text.

Returns

The text.

Verify(int, Sha256Hex) method

public void Verify(int expectedByteLength, Sha256Hex expectedSha256)

Checks the length and the SHA-256 against expected values.

Parameters

Exceptions

StrictJsonReadResult record

public sealed record StrictJsonReadResult

What the strict reader saw.

Parameters

StrictJsonReadResult(JsonValueKind, int, int, int) constructor

public StrictJsonReadResult(JsonValueKind RootKind, int ObjectPropertyCount, int ArrayElementCount, int MaximumDepth)

What the strict reader saw.

Parameters

ArrayElementCount property

public int ArrayElementCount { get; init; }

The elements of all arrays.

MaximumDepth property

public int MaximumDepth { get; init; }

The deepest nesting.

ObjectPropertyCount property

public int ObjectPropertyCount { get; init; }

The properties of all objects.

RootKind property

public JsonValueKind RootKind { get; init; }

The kind of the root value.

StrictJsonReader class

public static class StrictJsonReader

Reads JSON strictly: UTF-8 without a byte order mark, no duplicate property, strings that decode as Unicode, I-JSON numbers and the reader limits.

Validate(ReadOnlySpan<byte>, StrictJsonReaderOptions) method

public static StrictJsonReadResult Validate(ReadOnlySpan<byte> utf8Json, StrictJsonReaderOptions? options = null)

Checks JSON against the strict rules.

Parameters

Returns

What the reader saw.

Exceptions

StrictJsonReaderOptions record

public sealed record StrictJsonReaderOptions

Limits of the strict JSON reader that reads canonical durable JSON; every limit must be positive.

StrictJsonReaderOptions() constructor

public StrictJsonReaderOptions()

Creates an instance of StrictJsonReaderOptions.

DefaultArtifactBytes constant

public const int DefaultArtifactBytes = 16777216

The default input limit for an artifact: 16 MiB.

DefaultInlineBytes constant

public const int DefaultInlineBytes = 262144

The input limit for an inline value: 256 KiB.

MaxArrayElements property

public int MaxArrayElements { get; init; }

The most elements in one array. The default is 250000.

MaxDepth property

public int MaxDepth { get; init; }

The deepest nesting of objects and arrays. The default is 64.

MaxInputBytes property

public int MaxInputBytes { get; init; }

The largest input, in bytes. The default is StrictJsonReaderOptions.DefaultArtifactBytes.

MaxObjectProperties property

public int MaxObjectProperties { get; init; }

The most properties in one object. The default is 100000.

MaxStringUtf8Bytes property

public int MaxStringUtf8Bytes { get; init; }

The longest string, in UTF-8 bytes. The default is 1 MiB.

WorkflowJcsV1 class

public static class WorkflowJcsV1

The Workflow JSON canonicalization: strict reading, then RFC 8785 (JCS).

Name constant

public const string Name = "STELLAOPS-JCS-1"

The name of the canonicalization.

Canonicalize(ReadOnlySpan<byte>, StrictJsonReaderOptions) method

public static CanonicalJsonResult Canonicalize(ReadOnlySpan<byte> utf8Json, StrictJsonReaderOptions? options = null)

Reads JSON strictly and canonicalizes it.

Parameters

Returns

The canonical bytes and their SHA-256.

Exceptions

StellaOps.Workflow.Contracts.Durability.Execution namespace

TypeKindDescription
StartWorkflowDispositionenumThe decision on a durable start request.
StartWorkflowExecutionResultV1recordThe decision on a durable start request.
StartWorkflowExecutionV1recordA durable start request: the execution to create, its definition, business reference, caller idempotency, association and input.
WorkflowPrestartTerminalAckV1recordThe acknowledgement of a prestart terminal command.
WorkflowPrestartTerminalCommandV1recordA terminal command, such as a cancel, for a start that may not have arrived yet; it fences the start.

StartWorkflowDisposition enum

public enum StartWorkflowDisposition

The decision on a durable start request.

ValueDescription
STARTED = 0The execution was created.
ALREADY_STARTED = 1The execution already existed.
REJECTED_NOT_CREATED = 2The start was refused; no execution was created.
FENCED_NOT_CREATED = 3A terminal command arrived first; no execution was created.

StartWorkflowExecutionResultV1 record

public sealed record StartWorkflowExecutionResultV1 : IContractValidatable

The decision on a durable start request.

StartWorkflowExecutionResultV1() constructor

public StartWorkflowExecutionResultV1()

Creates an instance of StartWorkflowExecutionResultV1.

AssociationGeneration property

public required long AssociationGeneration { get; init; }

The generation of the association.

AssociationId property

public required string AssociationId { get; init; }

The association.

AssociationSha256 property

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

DecidedAt property

public required Rfc3339MillisecondInstant DecidedAt { get; init; }

When the decision was taken.

Disposition property

public required StartWorkflowDisposition Disposition { get; init; }

The decision.

EventId property

public required string EventId { get; init; }

The event identifier.

ExecutionVersion property

public required long? ExecutionVersion { get; init; }

The execution version the start created.

FirstEventSequence property

public required long? FirstEventSequence { get; init; }

The sequence of the first history event.

RootScopeExecutionId property

public required string RootScopeExecutionId { get; init; }

The root scope.

SafeCode property

public required string? SafeCode { get; init; }

The safe refusal code, when refused.

StartRequestId property

public required string StartRequestId { get; init; }

The start request.

StartRequestSha256 property

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

Validate() method

public void Validate()

Checks the fields.

Exceptions

ValidateAgainst(StartWorkflowExecutionV1) method

public void ValidateAgainst(StartWorkflowExecutionV1 request)

Checks that the result answers the request: the same start request, execution and association.

Parameters

Exceptions

StartWorkflowExecutionV1 record

public sealed record StartWorkflowExecutionV1 : IContractValidatable

A durable start request: the execution to create, its definition, business reference, caller idempotency, association and input.

StartWorkflowExecutionV1() constructor

public StartWorkflowExecutionV1()

Creates an instance of StartWorkflowExecutionV1.

AssociationGeneration property

public required long AssociationGeneration { get; init; }

The generation of the association.

AssociationId property

public required string AssociationId { get; init; }

The association.

AssociationSha256 property

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

BusinessReferenceSha256 property

public required Sha256Hex BusinessReferenceSha256 { get; init; }

The SHA-256 of the business reference.

CallerIdempotencySha256 property

public required Sha256Hex CallerIdempotencySha256 { get; init; }

The SHA-256 of the caller’s idempotency key.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

DefinitionCode property

public required string DefinitionCode { get; init; }

The workflow definition.

DefinitionSha256 property

public required Sha256Hex DefinitionSha256 { get; init; }

The SHA-256 of the definition.

DefinitionVersion property

public required string DefinitionVersion { get; init; }

The definition version.

Input property

public required JsonPayloadDescriptorV1 Input { get; init; }

The input payload.

PredecessorExecutionId property

public required string? PredecessorExecutionId { get; init; }

The execution this one continues, when it continues one.

RequestedAt property

public required Rfc3339MillisecondInstant RequestedAt { get; init; }

When the start was requested.

RootScopeExecutionId property

public required string RootScopeExecutionId { get; init; }

The root scope.

StartRequestId property

public required string StartRequestId { get; init; }

The start request.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

ComputeSha256() method

public Sha256Hex ComputeSha256()

The SHA-256 of the request’s canonical JSON.

Returns

The SHA-256.

Validate() method

public void Validate()

Checks the fields.

Exceptions

WorkflowPrestartTerminalAckV1 record

public sealed record WorkflowPrestartTerminalAckV1 : IContractValidatable

The acknowledgement of a prestart terminal command.

WorkflowPrestartTerminalAckV1() constructor

public WorkflowPrestartTerminalAckV1()

Creates an instance of WorkflowPrestartTerminalAckV1.

AssociationGeneration property

public required long AssociationGeneration { get; init; }

The generation of the association.

AssociationId property

public required string AssociationId { get; init; }

The association.

AssociationSha256 property

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

CleanupDisposition property

public required string CleanupDisposition { get; init; }

How the cleanup was handled.

CommandEventId property

public required string CommandEventId { get; init; }

The command.

CommandSha256 property

public required Sha256Hex CommandSha256 { get; init; }

The SHA-256 of the command.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

Disposition property

public required string Disposition { get; init; }

How the command was handled.

EventId property

public required string EventId { get; init; }

The event identifier.

LatchDisposition property

public required string LatchDisposition { get; init; }

How the terminal latch was handled.

OccurredAt property

public required Rfc3339MillisecondInstant OccurredAt { get; init; }

When it happened.

RootOutcome property

public required string? RootOutcome { get; init; }

The outcome of the root execution, when it exists.

SafeCode property

public required string? SafeCode { get; init; }

The safe refusal code, when refused.

ScopeExecutionId property

public required string ScopeExecutionId { get; init; }

The root scope.

StartRequestId property

public required string StartRequestId { get; init; }

The start request.

StartRequestSha256 property

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

TerminalFenceId property

public required string TerminalFenceId { get; init; }

The terminal fence.

TerminalFenceSha256 property

public required Sha256Hex TerminalFenceSha256 { get; init; }

The SHA-256 of the fence.

TerminalFenceVersion property

public required long TerminalFenceVersion { get; init; }

The fence version.

TerminalMode property

public required string TerminalMode { get; init; }

The terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

Validate() method

public void Validate()

Checks the fields.

Exceptions

ValidateAgainst(WorkflowPrestartTerminalCommandV1) method

public void ValidateAgainst(WorkflowPrestartTerminalCommandV1 command)

Checks that the acknowledgement answers the command.

Parameters

Exceptions

WorkflowPrestartTerminalCommandV1 record

public sealed record WorkflowPrestartTerminalCommandV1 : IContractValidatable

A terminal command, such as a cancel, for a start that may not have arrived yet; it fences the start.

WorkflowPrestartTerminalCommandV1() constructor

public WorkflowPrestartTerminalCommandV1()

Creates an instance of WorkflowPrestartTerminalCommandV1.

AssociationGeneration property

public required long AssociationGeneration { get; init; }

The generation of the association.

AssociationId property

public required string AssociationId { get; init; }

The association.

AssociationSha256 property

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

ContractVersion property

public required int ContractVersion { get; init; }

The contract version: 1.

EventId property

public required string EventId { get; init; }

The event identifier.

OccurredAt property

public required Rfc3339MillisecondInstant OccurredAt { get; init; }

When it happened.

ScopeExecutionId property

public required string ScopeExecutionId { get; init; }

The root scope.

StartRequestId property

public required string StartRequestId { get; init; }

The start request.

StartRequestSha256 property

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

TerminalFenceId property

public required string TerminalFenceId { get; init; }

The terminal fence.

TerminalFenceSha256 property

public required Sha256Hex TerminalFenceSha256 { get; init; }

The SHA-256 of the fence.

TerminalFenceVersion property

public required long TerminalFenceVersion { get; init; }

The fence version.

TerminalMode property

public required string TerminalMode { get; init; }

The terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.

WorkflowExecutionId property

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

Validate() method

public void Validate()

Checks the fields.

Exceptions

StellaOps.Workflow.Contracts.Durability.Payloads namespace

TypeKindDescription
DataSensitivityenumThe sensitivity of a payload.
JsonArtifactContentReferenceV1classThe artifact content reference of payloads.
JsonPayloadDescriptorV1recordA JSON payload, inline or in an artifact store, with its schema, canonical hash, length and sensitivity.
JsonPayloadTransportenumWhere a payload’s JSON travels.

DataSensitivity enum

public enum DataSensitivity

The sensitivity of a payload.

ValueDescription
PUBLIC = 0Public.
INTERNAL = 1Internal.
CONFIDENTIAL = 2Confidential.
RESTRICTED = 3Restricted.

JsonArtifactContentReferenceV1 class

public static class JsonArtifactContentReferenceV1

The artifact content reference of payloads.

DescriptorPropertyName constant

public const string DescriptorPropertyName = "stellaOpsArtifactContentV1"

The property name of the artifact content reference: stellaOpsArtifactContentV1.

JsonPayloadDescriptorV1 record

public sealed record JsonPayloadDescriptorV1 : IContractValidatable

A JSON payload, inline or in an artifact store, with its schema, canonical hash, length and sensitivity.

JsonPayloadDescriptorV1() constructor

public JsonPayloadDescriptorV1()

Creates an instance of JsonPayloadDescriptorV1.

ArtifactRef property

public string? ArtifactRef { get; init; }

The artifact reference, for an artifact payload: printable ASCII, at most 512 characters.

ByteLength property

public required long ByteLength { get; init; }

The length of the canonical JSON.

Canonicalization property

public required string Canonicalization { get; init; }

The canonicalization: WorkflowJcsV1.Name.

Compression property

public required string Compression { get; init; }

The compression: NONE.

DescriptorVersion property

public required int DescriptorVersion { get; init; }

The descriptor version: 1.

InlineJson property

public JsonElement InlineJson { get; init; }

The JSON, for an inline payload.

MediaType property

public required string MediaType { get; init; }

The media type: application/json.

SchemaId property

public required string SchemaId { get; init; }

The schema of the JSON.

SchemaVersion property

public required int SchemaVersion { get; init; }

The schema version, from 1.

Sensitivity property

public required DataSensitivity Sensitivity { get; init; }

The sensitivity.

Sha256 property

public required Sha256Hex Sha256 { get; init; }

The SHA-256 of the canonical JSON.

Transport property

public required JsonPayloadTransport Transport { get; init; }

Whether the JSON is inline or in an artifact.

Validate() method

public void Validate()

Checks the fields.

Exceptions

JsonPayloadTransport enum

public enum JsonPayloadTransport

Where a payload’s JSON travels.

ValueDescription
INLINE = 0The JSON is in the descriptor.
ARTIFACT = 1The JSON is in an artifact store.

StellaOps.Workflow.Contracts.Durability.Scalars namespace

TypeKindDescription
ConfidenceBasisPointsstructA confidence in basis points: 0 to 10000 (100%).
ConfidenceBasisPointsJsonConverterclassReads and writes a confidence as a JSON number.
DecimalStringstructAn exact decimal in canonical text: an optional minus, no leading zeros, and a fraction without trailing zeros; no negative zero.
DecimalStringJsonConverterclassReads and writes a decimal string as a JSON string.
GregorianDatestructA Gregorian date as YYYY-MM-DD text.
GregorianDateJsonConverterclassReads and writes a date as a JSON string.
Iso4217CodestructAn ISO 4217 currency code: three uppercase ASCII letters.
Iso4217CodeJsonConverterclassReads and writes a currency code as a JSON string.
NormalizedCoordinatestructA coordinate normalized to the range 0 to 1000000.
NormalizedCoordinateJsonConverterclassReads and writes a normalized coordinate as a JSON number.
Rfc3339MillisecondInstantstructA UTC instant as RFC 3339 text with exactly millisecond precision.
Rfc3339MillisecondInstantJsonConverterclassReads and writes an instant as a JSON string.
Sha256HexstructA SHA-256 digest as 64 lowercase hexadecimal characters.
Sha256HexJsonConverterclassReads and writes a digest as a JSON string.

ConfidenceBasisPoints struct

public readonly struct ConfidenceBasisPoints : IEquatable<ConfidenceBasisPoints>

A confidence in basis points: 0 to 10000 (100%).

ConfidenceBasisPoints(int) constructor

public ConfidenceBasisPoints(int value)

Creates a confidence.

Parameters

Exceptions

Value property

public int Value { get; }

The basis points.

ToString() method

public override string ToString()

Returns the basis points as invariant text.

Returns

The text.

ConfidenceBasisPointsJsonConverter class

public sealed class ConfidenceBasisPointsJsonConverter : JsonConverter<ConfidenceBasisPoints>

Reads and writes a confidence as a JSON number.

ConfidenceBasisPointsJsonConverter() constructor

public ConfidenceBasisPointsJsonConverter()

Creates an instance of ConfidenceBasisPointsJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override ConfidenceBasisPoints Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the confidence from a JSON number.

Parameters

Returns

The value.

Write(Utf8JsonWriter, ConfidenceBasisPoints, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, ConfidenceBasisPoints value, JsonSerializerOptions options)

Writes the confidence as a JSON number.

Parameters

DecimalString struct

public readonly struct DecimalString : IEquatable<DecimalString>

An exact decimal in canonical text: an optional minus, no leading zeros, and a fraction without trailing zeros; no negative zero.

DecimalValue property

public decimal DecimalValue { get; }

The value.

Scale property

public int Scale { get; }

The digits after the decimal point.

Value property

public string Value { get; }

The canonical text.

EnsureMaximumScale(int) method

public DecimalString EnsureMaximumScale(int maximumScale)

Checks the scale.

Parameters

Returns

The same value.

Exceptions

Parse(string) method

public static DecimalString Parse(string value)

Parses canonical text with at most 28 decimals.

Parameters

Returns

The decimal string.

Exceptions

Parse(string, int) method

public static DecimalString Parse(string value, int maximumScale)

Parses canonical text with at most maximumScale decimals.

Parameters

Returns

The decimal string.

Exceptions

ParseMoney(string) method

public static DecimalString ParseMoney(string value)

Parses an amount of money: at most 4 decimals.

Parameters

Returns

The decimal string.

Exceptions

ParseQuantity(string) method

public static DecimalString ParseQuantity(string value)

Parses a quantity: at most 6 decimals.

Parameters

Returns

The decimal string.

Exceptions

ParseRate(string) method

public static DecimalString ParseRate(string value)

Parses a rate: at most 8 decimals.

Parameters

Returns

The decimal string.

Exceptions

ToString() method

public override string ToString()

Returns the canonical text.

Returns

The text.

DecimalStringJsonConverter class

public sealed class DecimalStringJsonConverter : JsonConverter<DecimalString>

Reads and writes a decimal string as a JSON string.

DecimalStringJsonConverter() constructor

public DecimalStringJsonConverter()

Creates an instance of DecimalStringJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override DecimalString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the decimal string from a JSON string.

Parameters

Returns

The value.

Write(Utf8JsonWriter, DecimalString, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, DecimalString value, JsonSerializerOptions options)

Writes the decimal string as a JSON string.

Parameters

GregorianDate struct

public readonly struct GregorianDate : IEquatable<GregorianDate>

A Gregorian date as YYYY-MM-DD text.

Date property

public DateOnly Date { get; }

The date.

Value property

public string Value { get; }

The text.

Parse(string) method

public static GregorianDate Parse(string value)

Parses YYYY-MM-DD text.

Parameters

Returns

The date.

Exceptions

ToString() method

public override string ToString()

Returns the canonical text.

Returns

The text.

GregorianDateJsonConverter class

public sealed class GregorianDateJsonConverter : JsonConverter<GregorianDate>

Reads and writes a date as a JSON string.

GregorianDateJsonConverter() constructor

public GregorianDateJsonConverter()

Creates an instance of GregorianDateJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override GregorianDate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the date from a JSON string.

Parameters

Returns

The value.

Write(Utf8JsonWriter, GregorianDate, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, GregorianDate value, JsonSerializerOptions options)

Writes the date as a JSON string.

Parameters

Iso4217Code struct

public readonly struct Iso4217Code : IEquatable<Iso4217Code>

An ISO 4217 currency code: three uppercase ASCII letters.

Iso4217Code(string) constructor

public Iso4217Code(string value)

Creates a currency code.

Parameters

Exceptions

Value property

public string Value { get; }

The code.

Parse(string) method

public static Iso4217Code Parse(string value)

Parses a currency code.

Parameters

Returns

The code.

Exceptions

ToString() method

public override string ToString()

Returns the canonical text.

Returns

The text.

Iso4217CodeJsonConverter class

public sealed class Iso4217CodeJsonConverter : JsonConverter<Iso4217Code>

Reads and writes a currency code as a JSON string.

Iso4217CodeJsonConverter() constructor

public Iso4217CodeJsonConverter()

Creates an instance of Iso4217CodeJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override Iso4217Code Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the currency code from a JSON string.

Parameters

Returns

The value.

Write(Utf8JsonWriter, Iso4217Code, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, Iso4217Code value, JsonSerializerOptions options)

Writes the currency code as a JSON string.

Parameters

NormalizedCoordinate struct

public readonly struct NormalizedCoordinate : IEquatable<NormalizedCoordinate>

A coordinate normalized to the range 0 to 1000000.

NormalizedCoordinate(int) constructor

public NormalizedCoordinate(int value)

Creates a coordinate.

Parameters

Exceptions

Value property

public int Value { get; }

The coordinate.

ToString() method

public override string ToString()

Returns the coordinate as invariant text.

Returns

The text.

NormalizedCoordinateJsonConverter class

public sealed class NormalizedCoordinateJsonConverter : JsonConverter<NormalizedCoordinate>

Reads and writes a normalized coordinate as a JSON number.

NormalizedCoordinateJsonConverter() constructor

public NormalizedCoordinateJsonConverter()

Creates an instance of NormalizedCoordinateJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override NormalizedCoordinate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the coordinate from a JSON number.

Parameters

Returns

The value.

Write(Utf8JsonWriter, NormalizedCoordinate, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, NormalizedCoordinate value, JsonSerializerOptions options)

Writes the coordinate as a JSON number.

Parameters

Rfc3339MillisecondInstant struct

public readonly struct Rfc3339MillisecondInstant : IEquatable<Rfc3339MillisecondInstant>

A UTC instant as RFC 3339 text with exactly millisecond precision.

Format constant

public const string Format = "yyyy-MM-dd'T'HH:mm:ss.fff'Z'"

The text format: yyyy-MM-ddTHH:mm:ss.fffZ.

Instant property

public DateTimeOffset Instant { get; }

The instant.

Value property

public string Value { get; }

The text.

FromDateTimeOffset(DateTimeOffset) method

public static Rfc3339MillisecondInstant FromDateTimeOffset(DateTimeOffset value)

Converts an instant with exact millisecond precision to UTC text.

Parameters

Returns

The instant.

Exceptions

Parse(string) method

public static Rfc3339MillisecondInstant Parse(string value)

Parses the text format.

Parameters

Returns

The instant.

Exceptions

ToString() method

public override string ToString()

Returns the canonical text.

Returns

The text.

Rfc3339MillisecondInstantJsonConverter class

public sealed class Rfc3339MillisecondInstantJsonConverter : JsonConverter<Rfc3339MillisecondInstant>

Reads and writes an instant as a JSON string.

Rfc3339MillisecondInstantJsonConverter() constructor

public Rfc3339MillisecondInstantJsonConverter()

Creates an instance of Rfc3339MillisecondInstantJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override Rfc3339MillisecondInstant Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the instant from a JSON string.

Parameters

Returns

The value.

Write(Utf8JsonWriter, Rfc3339MillisecondInstant, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, Rfc3339MillisecondInstant value, JsonSerializerOptions options)

Writes the instant as a JSON string.

Parameters

Sha256Hex struct

public readonly struct Sha256Hex : IEquatable<Sha256Hex>

A SHA-256 digest as 64 lowercase hexadecimal characters.

Sha256Hex(string) constructor

public Sha256Hex(string value)

Creates a digest.

Parameters

Exceptions

Value property

public string Value { get; }

The hexadecimal text.

FixedTimeEquals(Sha256Hex) method

public bool FixedTimeEquals(Sha256Hex other)

Compares two digests in constant time.

Parameters

Returns

Whether they are equal; false when either is empty.

FromBytes(ReadOnlySpan<byte>) method

public static Sha256Hex FromBytes(ReadOnlySpan<byte> bytes)

Creates a digest from its 32 bytes.

Parameters

Returns

The digest.

Exceptions

Parse(string) method

public static Sha256Hex Parse(string value)

Parses a digest.

Parameters

Returns

The digest.

Exceptions

ToString() method

public override string ToString()

Returns the canonical text.

Returns

The text.

TryParse(string, out Sha256Hex) method

public static bool TryParse(string? value, out Sha256Hex result)

Parses a digest.

Parameters

Returns

Whether it is valid.

Sha256HexJsonConverter class

public sealed class Sha256HexJsonConverter : JsonConverter<Sha256Hex>

Reads and writes a digest as a JSON string.

Sha256HexJsonConverter() constructor

public Sha256HexJsonConverter()

Creates an instance of Sha256HexJsonConverter.

Read(ref Utf8JsonReader, Type, JsonSerializerOptions) method

public override Sha256Hex Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Reads the digest from a JSON string.

Parameters

Returns

The value.

Write(Utf8JsonWriter, Sha256Hex, JsonSerializerOptions) method

public override void Write(Utf8JsonWriter writer, Sha256Hex value, JsonSerializerOptions options)

Writes the digest as a JSON string.

Parameters

StellaOps.Workflow.Contracts.Durability.Schemas namespace

TypeKindDescription
ContractSchemaValidationExceptionclassRaised when a value does not match a frozen schema.
FrozenContractSchemaSetclassImmutable in-assembly copy of the frozen v1 contract schemas.
FrozenSchemaDescriptorrecordA frozen schema.

ContractSchemaValidationException class

public sealed class ContractSchemaValidationException : Exception

Raised when a value does not match a frozen schema.

Parameters

ContractSchemaValidationException(string, string, string) constructor

public ContractSchemaValidationException(string schemaReference, string instanceLocation, string message)

Raised when a value does not match a frozen schema.

Parameters

InstanceLocation property

public string InstanceLocation { get; }

Where in the value.

SchemaReference property

public string SchemaReference { get; }

The schema reference.

FrozenContractSchemaSet class

public sealed class FrozenContractSchemaSet

Immutable in-assembly copy of the frozen v1 contract schemas. Every evaluation uses a self-contained compound schema document, so resolution never uses the network or JsonSchema.Net’s process-global schema registry.

SchemaIds property

public IReadOnlyCollection<string> SchemaIds { get; }

The schema ids.

V1 property

public static FrozenContractSchemaSet V1 { get; }

The frozen v1 schemas.

GetDescriptor(string) method

public FrozenSchemaDescriptor GetDescriptor(string schemaId)

Returns the descriptor of a schema.

Parameters

Returns

The descriptor.

Exceptions

IsValid(JsonElement, string) method

public bool IsValid(JsonElement instance, string schemaReference)

Whether a value matches a schema.

Parameters

Returns

Whether it matches.

Validate(JsonElement, string) method

public void Validate(JsonElement instance, string schemaReference)

Checks a value against a schema.

Parameters

Exceptions

FrozenSchemaDescriptor record

public sealed record FrozenSchemaDescriptor

A frozen schema.

Parameters

FrozenSchemaDescriptor(string, Sha256Hex, int) constructor

public FrozenSchemaDescriptor(string SchemaId, Sha256Hex Sha256, int CanonicalByteLength)

A frozen schema.

Parameters

CanonicalByteLength property

public int CanonicalByteLength { get; init; }

The length of its canonical JSON.

SchemaId property

public string SchemaId { get; init; }

The schema id.

Sha256 property

public Sha256Hex Sha256 { get; init; }

The SHA-256 of its canonical JSON.

StellaOps.Workflow.Contracts.Durability.Serialization namespace

TypeKindDescription
ContractJsonCodecclassReads and writes the durable contracts as canonical JSON.
DecodedContract<T>recordA decoded contract with its canonical JSON.

ContractJsonCodec class

public static class ContractJsonCodec

Reads and writes the durable contracts as canonical JSON.

ComputeSha256<T>(T) method

public static Sha256Hex ComputeSha256<T>(T value) where T : IContractValidatable

The SHA-256 of a contract’s canonical JSON.

Type parameters

Parameters

Returns

The SHA-256.

ComputeValueSha256<T>(T) method

public static Sha256Hex ComputeValueSha256<T>(T value)

The SHA-256 of any value’s canonical JSON.

Type parameters

Parameters

Returns

The SHA-256.

CreateIsolatedSerializerOptions() method

public static JsonSerializerOptions CreateIsolatedSerializerOptions()

A copy of the contract serializer options.

Returns

The options.

Decode<T>(ReadOnlySpan<byte>, StrictJsonReaderOptions) method

public static DecodedContract<T> Decode<T>(ReadOnlySpan<byte> utf8Json, StrictJsonReaderOptions? readerOptions = null) where T : IContractValidatable

Reads a contract strictly and canonically, then checks its fields.

Type parameters

Parameters

Returns

The contract and its canonical JSON.

DecodeUnchecked<T>(ReadOnlySpan<byte>, StrictJsonReaderOptions) method

public static DecodedContract<T> DecodeUnchecked<T>(ReadOnlySpan<byte> utf8Json, StrictJsonReaderOptions? readerOptions = null) where T : IContractValidatable

Reads a contract strictly and canonically, without checking its fields.

Type parameters

Parameters

Returns

The contract and its canonical JSON.

DecodeWithSchema<T>(ReadOnlySpan<byte>, string, StrictJsonReaderOptions) method

public static DecodedContract<T> DecodeWithSchema<T>(ReadOnlySpan<byte> utf8Json, string schemaReference, StrictJsonReaderOptions? readerOptions = null) where T : IContractValidatable

Reads a contract strictly and canonically and checks it against a frozen schema.

Type parameters

Parameters

Returns

The contract and its canonical JSON.

Encode<T>(T) method

public static CanonicalJsonResult Encode<T>(T value) where T : IContractValidatable

Checks a contract’s fields and writes it as canonical JSON.

Type parameters

Parameters

Returns

The canonical JSON.

EncodeValue<T>(T) method

public static CanonicalJsonResult EncodeValue<T>(T value)

Writes any value as canonical JSON.

Type parameters

Parameters

Returns

The canonical JSON.

DecodedContract<T> record

public sealed record DecodedContract<T>

A decoded contract with its canonical JSON.

Type parameters

Parameters

DecodedContract(T, CanonicalJsonResult) constructor

public DecodedContract(T Value, CanonicalJsonResult CanonicalJson)

A decoded contract with its canonical JSON.

Type parameters

Parameters

CanonicalJson property

public CanonicalJsonResult CanonicalJson { get; init; }

Its canonical JSON.

Value property

public T Value { get; init; }

The contract.

StellaOps.Workflow.Contracts.Durability.Validation namespace

TypeKindDescription
ContractValidationclassThe field rules of the durable contracts.
ContractValidationExceptionclassRaised when a durable contract field breaks its rule.
IContractValidatableinterfaceA durable contract that checks its own fields.

ContractValidation class

public static class ContractValidation

The field rules of the durable contracts.

MaximumSafeInteger constant

public const long MaximumSafeInteger = 9007199254740991

The largest integer a JSON number carries exactly: 2^53 - 1.

Require(bool, string, string) method

public static void Require(bool condition, string code, string pointer)

Raises a validation error when a condition fails.

Parameters

Exceptions

RequireCallerNamespace(string, string) method

public static void RequireCallerNamespace(string value, string pointer)

Requires a caller namespace: 3 to 128 lowercase letters, digits, _, . or -, starting with a letter (CONTRACT_CALLER_NAMESPACE_INVALID).

Parameters

Exceptions

RequireCode(string, string) method

public static void RequireCode(string value, string pointer)

Requires a code: 1 to 128 uppercase letters, digits, _, . or -, starting with a letter (CONTRACT_CODE_INVALID).

Parameters

Exceptions

RequireContractVersion(int, string) method

public static void RequireContractVersion(int value, string pointer = "/contractVersion")

Requires contract version 1 (CONTRACT_VERSION_UNSUPPORTED).

Parameters

Exceptions

RequireExecutionId(string, string) method

public static void RequireExecutionId(string value, string pointer)

Requires an execution id: 8 to 128 letters, digits, ., _, : or -, starting with a letter or digit (CONTRACT_EXECUTION_ID_INVALID).

Parameters

Exceptions

RequireOpaqueAscii(string, int, string) method

public static void RequireOpaqueAscii(string value, int maximumLength, string pointer)

Requires printable ASCII without spaces, 1 to maximumLength characters (CONTRACT_OPAQUE_ASCII_INVALID).

Parameters

Exceptions

RequireSafeNonNegative(long, string) method

public static void RequireSafeNonNegative(long value, string pointer)

Requires an integer from 0 to ContractValidation.MaximumSafeInteger(CONTRACT_SAFE_INTEGER_INVALID).

Parameters

Exceptions

RequireSafePositive(long, string) method

public static void RequireSafePositive(long value, string pointer)

Requires an integer from 1 to ContractValidation.MaximumSafeInteger(CONTRACT_SAFE_INTEGER_INVALID).

Parameters

Exceptions

RequireSchemaId(string, string) method

public static void RequireSchemaId(string value, string pointer)

Requires a schema id: 3 to 200 characters, path segments of lowercase letters, digits, ., _ or - (PAYLOAD_SCHEMA_ID_INVALID).

Parameters

Exceptions

RequireVersion(string, string) method

public static void RequireVersion(string value, string pointer)

Requires a version text: 1 to 100 letters, digits, ., _, + or -, starting with a letter or digit (CONTRACT_VERSION_TEXT_INVALID).

Parameters

Exceptions

ContractValidationException class

public sealed class ContractValidationException : Exception

Raised when a durable contract field breaks its rule.

ContractValidationException(string, string) constructor

public ContractValidationException(string code, string jsonPointer)

Creates the exception.

Parameters

Code property

public string Code { get; }

The error code.

JsonPointer property

public string JsonPointer { get; }

The JSON pointer of the field.

IContractValidatable interface

public interface IContractValidatable

A durable contract that checks its own fields.

Validate() method

void Validate()

Checks the fields.

Exceptions