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.

library
Component
Workflow
Licence
BUSL-1.1 (Workflow licence)
Target framework
net10.0
Latest release
1.0.1-20261118T121708Z

Install

dotnet add package StellaOps.Workflow.Contracts.Durability --version 1.0.1-20261118T121708Z

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

namespace StellaOps.Workflow.Contracts.Durability.Activities

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.

record WorkflowActivityCancelActiveAttemptV1

public sealed record WorkflowActivityCancelActiveAttemptV1 : IContractValidatable

The attempt a cancel stops.

Members

MemberKindSummary
WorkflowActivityCancelActiveAttemptV1()constructorCreates an instance of WorkflowActivityCancelActiveAttemptV1.
AttemptIdpropertyThe attempt.
DispatchIdpropertyThe dispatch.
RequestSha256propertyThe SHA-256 of the request.
Validate()methodChecks the fields.

constructor WorkflowActivityCancelActiveAttemptV1() #

public WorkflowActivityCancelActiveAttemptV1()

Creates an instance of WorkflowActivityCancelActiveAttemptV1.

property AttemptId #

public required string AttemptId { get; init; }

The attempt.

property DispatchId #

public required string DispatchId { get; init; }

The dispatch.

property RequestSha256 #

public required Sha256Hex RequestSha256 { get; init; }

The SHA-256 of the request.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowActivityCancelContinuationLineageV1

public sealed record WorkflowActivityCancelContinuationLineageV1 : IContractValidatable

The continuation a cancel revokes.

Members

MemberKindSummary
WorkflowActivityCancelContinuationLineageV1()constructorCreates an instance of WorkflowActivityCancelContinuationLineageV1.
ContinuationRefpropertyThe provider’s continuation reference.
ContinuationSha256propertyThe SHA-256 of the continuation.
GenerationpropertyThe continuation generation.
LineageIdpropertyThe lineage.
SourceAttemptIdpropertyThe attempt that left the continuation.
SourceCompletionEventIdpropertyThe completion that carried it.
Validate()methodChecks the fields.

constructor WorkflowActivityCancelContinuationLineageV1() #

public WorkflowActivityCancelContinuationLineageV1()

Creates an instance of WorkflowActivityCancelContinuationLineageV1.

property ContinuationRef #

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

property ContinuationSha256 #

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

property Generation #

public required long Generation { get; init; }

The continuation generation.

property LineageId #

public required string LineageId { get; init; }

The lineage.

property SourceAttemptId #

public required string SourceAttemptId { get; init; }

The attempt that left the continuation.

property SourceCompletionEventId #

public required string SourceCompletionEventId { get; init; }

The completion that carried it.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowActivityCancelV1

public sealed record WorkflowActivityCancelV1 : IContractValidatable

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

Members

MemberKindSummary
WorkflowActivityCancelV1()constructorCreates an instance of WorkflowActivityCancelV1.
ActiveAttemptpropertyThe attempt to stop, when one may still run.
CancelFenceVersionpropertyThe cancel fence of the request.
CancelIdpropertyThe cancel request.
CanceledAtpropertyWhen the step was canceled.
ContinuationLineagepropertyThe continuation to revoke, when there is one.
ContractVersionpropertyThe contract version: 1.
DeadlineAtpropertyThe deadline that stopped the step, for a deadline cancel.
EventIdpropertyThe event identifier.
ReasonCodepropertyWhy.
ScopeExecutionIdpropertyThe scope.
StepExecutionIdpropertyThe step execution.
WorkflowExecutionIdpropertyThe execution (workflow instance).
Validate()methodChecks the fields.

constructor WorkflowActivityCancelV1() #

public WorkflowActivityCancelV1()

Creates an instance of WorkflowActivityCancelV1.

property ActiveAttempt #

public required WorkflowActivityCancelActiveAttemptV1? ActiveAttempt { get; init; }

The attempt to stop, when one may still run.

property CancelFenceVersion #

public required long CancelFenceVersion { get; init; }

The cancel fence of the request.

property CancelId #

public required string CancelId { get; init; }

The cancel request.

property CanceledAt #

public required Rfc3339MillisecondInstant CanceledAt { get; init; }

When the step was canceled.

property ContinuationLineage #

public required WorkflowActivityCancelContinuationLineageV1? ContinuationLineage { get; init; }

The continuation to revoke, when there is one.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property DeadlineAt #

public required Rfc3339MillisecondInstant? DeadlineAt { get; init; }

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

property EventId #

public required string EventId { get; init; }

The event identifier.

property ReasonCode #

public required string ReasonCode { get; init; }

Why.

property ScopeExecutionId #

public required string ScopeExecutionId { get; init; }

The scope.

property StepExecutionId #

public required string StepExecutionId { get; init; }

The step execution.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowActivityCompletionContinuationV1

public sealed record WorkflowActivityCompletionContinuationV1 : IContractValidatable

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

Members

MemberKindSummary
WorkflowActivityCompletionContinuationV1()constructorCreates an instance of WorkflowActivityCompletionContinuationV1.
ContinuationRefpropertyThe provider’s continuation reference.
ContinuationSha256propertyThe SHA-256 of the continuation.
GenerationpropertyThe continuation generation.
Validate()methodChecks the fields.

constructor WorkflowActivityCompletionContinuationV1() #

public WorkflowActivityCompletionContinuationV1()

Creates an instance of WorkflowActivityCompletionContinuationV1.

property ContinuationRef #

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

property ContinuationSha256 #

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

property Generation #

public required long Generation { get; init; }

The continuation generation.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowActivityCompletionV1

public sealed record WorkflowActivityCompletionV1 : IContractValidatable

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

Members

MemberKindSummary
WorkflowActivityCompletionV1()constructorCreates an instance of WorkflowActivityCompletionV1.
AttemptIdpropertyThe attempt.
CompletedAtpropertyWhen the attempt completed.
ContinuationpropertyA continuation for the next attempt to resume.
ContractVersionpropertyThe contract version: 1.
DispatchIdpropertyThe dispatch.
EventIdpropertyThe event identifier.
FailurepropertyWhy it failed, for a failure.
OperationCodepropertyThe operation of the activity.
OutcomepropertyThe outcome.
RequestSha256propertyThe SHA-256 of the request it answers.
ResultpropertyThe result payload, for a success.
ScopeExecutionIdpropertyThe scope.
StepExecutionIdpropertyThe step execution.
WorkflowExecutionIdpropertyThe execution (workflow instance).
Validate()methodChecks the fields.
ValidateAgainst(WorkflowActivityRequestV1)methodChecks that the completion answers the request.

constructor WorkflowActivityCompletionV1() #

public WorkflowActivityCompletionV1()

Creates an instance of WorkflowActivityCompletionV1.

property AttemptId #

public required string AttemptId { get; init; }

The attempt.

property CompletedAt #

public required Rfc3339MillisecondInstant CompletedAt { get; init; }

When the attempt completed.

property Continuation #

public required WorkflowActivityCompletionContinuationV1? Continuation { get; init; }

A continuation for the next attempt to resume.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property DispatchId #

public required string DispatchId { get; init; }

The dispatch.

property EventId #

public required string EventId { get; init; }

The event identifier.

property Failure #

public required WorkflowActivityFailureV1? Failure { get; init; }

Why it failed, for a failure.

property OperationCode #

public required string OperationCode { get; init; }

The operation of the activity.

property Outcome #

public required WorkflowActivityOutcome Outcome { get; init; }

The outcome.

property RequestSha256 #

public required Sha256Hex RequestSha256 { get; init; }

The SHA-256 of the request it answers.

property Result #

public required JsonPayloadDescriptorV1? Result { get; init; }

The result payload, for a success.

property ScopeExecutionId #

public required string ScopeExecutionId { get; init; }

The scope.

property StepExecutionId #

public required string StepExecutionId { get; init; }

The step execution.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method Validate() #

public void Validate()

Checks the fields.

Exceptions

method ValidateAgainst(WorkflowActivityRequestV1) #

public void ValidateAgainst(WorkflowActivityRequestV1 request)

Checks that the completion answers the request.

Parameters

  • request: The request.

Exceptions

record WorkflowActivityFailureV1

public sealed record WorkflowActivityFailureV1 : IContractValidatable

Why an activity attempt failed.

Members

MemberKindSummary
WorkflowActivityFailureV1()constructorCreates an instance of WorkflowActivityFailureV1.
CategorypropertyThe failure category, which the retry policy matches.
CodepropertyThe failure code.
RetryAfterpropertyWhen the provider asks the retry to wait until.
Validate()methodChecks the fields.

constructor WorkflowActivityFailureV1() #

public WorkflowActivityFailureV1()

Creates an instance of WorkflowActivityFailureV1.

property Category #

public required string Category { get; init; }

The failure category, which the retry policy matches.

property Code #

public required string Code { get; init; }

The failure code.

property RetryAfter #

public required Rfc3339MillisecondInstant? RetryAfter { get; init; }

When the provider asks the retry to wait until.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

enum WorkflowActivityOutcome

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.

record WorkflowActivityRequestContinuationV1

public sealed record WorkflowActivityRequestContinuationV1 : IContractValidatable

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

Members

MemberKindSummary
WorkflowActivityRequestContinuationV1()constructorCreates an instance of WorkflowActivityRequestContinuationV1.
ContinuationRefpropertyThe provider’s continuation reference.
ContinuationSha256propertyThe SHA-256 of the continuation.
GenerationpropertyThe continuation generation.
PriorAttemptIdpropertyThe prior attempt.
PriorCompletionEventIdpropertyThe prior completion.
Validate()methodChecks the fields.

constructor WorkflowActivityRequestContinuationV1() #

public WorkflowActivityRequestContinuationV1()

Creates an instance of WorkflowActivityRequestContinuationV1.

property ContinuationRef #

public required string ContinuationRef { get; init; }

The provider’s continuation reference.

property ContinuationSha256 #

public required Sha256Hex ContinuationSha256 { get; init; }

The SHA-256 of the continuation.

property Generation #

public required long Generation { get; init; }

The continuation generation.

property PriorAttemptId #

public required string PriorAttemptId { get; init; }

The prior attempt.

property PriorCompletionEventId #

public required string PriorCompletionEventId { get; init; }

The prior completion.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowActivityRequestV1

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.

Members

MemberKindSummary
WorkflowActivityRequestV1()constructorCreates an instance of WorkflowActivityRequestV1.
AttemptIdpropertyThe attempt.
ContinuationpropertyThe continuation a retry resumes, when it resumes one.
ContractVersionpropertyThe contract version: 1.
DeadlineAtpropertyThe deadline of the attempt.
DispatchIdpropertyThe dispatch.
InputpropertyThe input payload.
OperationCodepropertyThe operation of the activity.
OperationVersionpropertyThe operation version.
ScopeExecutionIdpropertyThe scope.
StepExecutionIdpropertyThe step execution.
WorkflowExecutionIdpropertyThe execution (workflow instance).
ComputeSha256()methodThe SHA-256 of the request’s canonical JSON.
Validate()methodChecks the fields.
ValidateContinuationOf(WorkflowActivityCompletionV1)methodChecks that the request resumes the continuation of a prior completion.

constructor WorkflowActivityRequestV1() #

public WorkflowActivityRequestV1()

Creates an instance of WorkflowActivityRequestV1.

property AttemptId #

public required string AttemptId { get; init; }

The attempt.

property Continuation #

public required WorkflowActivityRequestContinuationV1? Continuation { get; init; }

The continuation a retry resumes, when it resumes one.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property DeadlineAt #

public required Rfc3339MillisecondInstant DeadlineAt { get; init; }

The deadline of the attempt.

property DispatchId #

public required string DispatchId { get; init; }

The dispatch.

property Input #

public required JsonPayloadDescriptorV1 Input { get; init; }

The input payload.

property OperationCode #

public required string OperationCode { get; init; }

The operation of the activity.

property OperationVersion #

public required string OperationVersion { get; init; }

The operation version.

property ScopeExecutionId #

public required string ScopeExecutionId { get; init; }

The scope.

property StepExecutionId #

public required string StepExecutionId { get; init; }

The step execution.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method ComputeSha256() #

public Sha256Hex ComputeSha256()

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

Returns

The SHA-256.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

method ValidateContinuationOf(WorkflowActivityCompletionV1) #

public void ValidateContinuationOf(WorkflowActivityCompletionV1 priorCompletion)

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

Parameters

  • priorCompletion: The prior completion.

Exceptions

namespace StellaOps.Workflow.Contracts.Durability.CanonicalJson

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).

class CanonicalJsonErrorCodes

public static class CanonicalJsonErrorCodes

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

Members

MemberKindSummary
BomNotAllowedconstantThe JSON starts with a byte order mark.
CanonicalizationFailedconstantThe canonicalization failed.
DuplicatePropertyconstantAn object has the same property twice.
InvalidUnicodeconstantA string does not decode as Unicode, such as one with an unpaired surrogate.
InvalidUtf8constantThe bytes are not valid UTF-8.
LimitExceededconstantA reader limit is exceeded.
NumberNotIJsonconstantA number is outside the I-JSON range (RFC 7493).
PayloadHashMismatchconstantThe canonical SHA-256 differs from the expected one.
PayloadLengthMismatchconstantThe canonical length differs from the expected one.
SyntaxInvalidconstantThe JSON syntax is not valid.

constant BomNotAllowed #

public const string BomNotAllowed = "JSON_BOM_NOT_ALLOWED"

The JSON starts with a byte order mark.

constant CanonicalizationFailed #

public const string CanonicalizationFailed = "JSON_CANONICALIZATION_FAILED"

The canonicalization failed.

constant DuplicateProperty #

public const string DuplicateProperty = "JSON_DUPLICATE_PROPERTY"

An object has the same property twice.

constant InvalidUnicode #

public const string InvalidUnicode = "JSON_INVALID_UNICODE"

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

constant InvalidUtf8 #

public const string InvalidUtf8 = "JSON_INVALID_UTF8"

The bytes are not valid UTF-8.

constant LimitExceeded #

public const string LimitExceeded = "JSON_LIMIT_EXCEEDED"

A reader limit is exceeded.

constant NumberNotIJson #

public const string NumberNotIJson = "JSON_NUMBER_NOT_IJSON"

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

constant PayloadHashMismatch #

public const string PayloadHashMismatch = "PAYLOAD_HASH_MISMATCH"

The canonical SHA-256 differs from the expected one.

constant PayloadLengthMismatch #

public const string PayloadLengthMismatch = "PAYLOAD_LENGTH_MISMATCH"

The canonical length differs from the expected one.

constant SyntaxInvalid #

public const string SyntaxInvalid = "JSON_SYNTAX_INVALID"

The JSON syntax is not valid.

class CanonicalJsonException

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.

Members

MemberKindSummary
CanonicalJsonException(string, string, string, Exception)constructorCreates the exception.
CodepropertyThe error code.
JsonPointerpropertyThe JSON pointer of the value.
LimitNamepropertyThe limit exceeded, when one was.

constructor CanonicalJsonException(string, string, string, Exception) #

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

Creates the exception.

Parameters

  • code: The error code; see CanonicalJsonErrorCodes.
  • jsonPointer: The JSON pointer of the value.
  • limitName: The limit exceeded, when one was.
  • innerException: The cause.

property Code #

public string Code { get; }

The error code.

property JsonPointer #

public string JsonPointer { get; }

The JSON pointer of the value.

property LimitName #

public string? LimitName { get; }

The limit exceeded, when one was.

class CanonicalJsonResult

public sealed class CanonicalJsonResult

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

Members

MemberKindSummary
ByteLengthpropertyThe byte length.
BytespropertyThe canonical UTF-8 bytes.
RootKindpropertyThe kind of the root value.
Sha256propertyThe SHA-256 of the bytes.
GetUtf8String()methodReturns the canonical JSON as text.
Verify(int, Sha256Hex)methodChecks the length and the SHA-256 against expected values.

property ByteLength #

public int ByteLength { get; }

The byte length.

property Bytes #

public ReadOnlyMemory<byte> Bytes { get; }

The canonical UTF-8 bytes.

property RootKind #

public JsonValueKind RootKind { get; }

The kind of the root value.

property Sha256 #

public Sha256Hex Sha256 { get; }

The SHA-256 of the bytes.

method GetUtf8String() #

public string GetUtf8String()

Returns the canonical JSON as text.

Returns

The text.

method Verify(int, Sha256Hex) #

public void Verify(int expectedByteLength, Sha256Hex expectedSha256)

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

Parameters

  • expectedByteLength: The expected length.
  • expectedSha256: The expected SHA-256.

Exceptions

record StrictJsonReadResult

public sealed record StrictJsonReadResult

What the strict reader saw.

Parameters

  • RootKind: The kind of the root value.
  • ObjectPropertyCount: The properties of all objects.
  • ArrayElementCount: The elements of all arrays.
  • MaximumDepth: The deepest nesting.

Members

MemberKindSummary
StrictJsonReadResult(JsonValueKind, int, int, int)constructorWhat the strict reader saw.
ArrayElementCountpropertyThe elements of all arrays.
MaximumDepthpropertyThe deepest nesting.
ObjectPropertyCountpropertyThe properties of all objects.
RootKindpropertyThe kind of the root value.

constructor StrictJsonReadResult(JsonValueKind, int, int, int) #

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

What the strict reader saw.

Parameters

  • RootKind: The kind of the root value.
  • ObjectPropertyCount: The properties of all objects.
  • ArrayElementCount: The elements of all arrays.
  • MaximumDepth: The deepest nesting.

property ArrayElementCount #

public int ArrayElementCount { get; init; }

The elements of all arrays.

property MaximumDepth #

public int MaximumDepth { get; init; }

The deepest nesting.

property ObjectPropertyCount #

public int ObjectPropertyCount { get; init; }

The properties of all objects.

property RootKind #

public JsonValueKind RootKind { get; init; }

The kind of the root value.

class StrictJsonReader

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.

Members

MemberKindSummary
Validate(ReadOnlySpan<byte>, StrictJsonReaderOptions)methodChecks JSON against the strict rules.

method Validate(ReadOnlySpan<byte>, StrictJsonReaderOptions) #

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

Checks JSON against the strict rules.

Parameters

  • utf8Json: The UTF-8 JSON.
  • options: The reader limits; the defaults when not set.

Returns

What the reader saw.

Exceptions

record StrictJsonReaderOptions

public sealed record StrictJsonReaderOptions

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

Members

MemberKindSummary
StrictJsonReaderOptions()constructorCreates an instance of StrictJsonReaderOptions.
DefaultArtifactBytesconstantThe default input limit for an artifact: 16 MiB.
DefaultInlineBytesconstantThe input limit for an inline value: 256 KiB.
MaxArrayElementspropertyThe most elements in one array.
MaxDepthpropertyThe deepest nesting of objects and arrays.
MaxInputBytespropertyThe largest input, in bytes.
MaxObjectPropertiespropertyThe most properties in one object.
MaxStringUtf8BytespropertyThe longest string, in UTF-8 bytes.

constructor StrictJsonReaderOptions() #

public StrictJsonReaderOptions()

Creates an instance of StrictJsonReaderOptions.

constant DefaultArtifactBytes #

public const int DefaultArtifactBytes = 16777216

The default input limit for an artifact: 16 MiB.

constant DefaultInlineBytes #

public const int DefaultInlineBytes = 262144

The input limit for an inline value: 256 KiB.

property MaxArrayElements #

public int MaxArrayElements { get; init; }

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

property MaxDepth #

public int MaxDepth { get; init; }

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

property MaxInputBytes #

public int MaxInputBytes { get; init; }

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

property MaxObjectProperties #

public int MaxObjectProperties { get; init; }

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

property MaxStringUtf8Bytes #

public int MaxStringUtf8Bytes { get; init; }

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

class WorkflowJcsV1

public static class WorkflowJcsV1

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

Members

MemberKindSummary
NameconstantThe name of the canonicalization.
Canonicalize(ReadOnlySpan<byte>, StrictJsonReaderOptions)methodReads JSON strictly and canonicalizes it.

constant Name #

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

The name of the canonicalization.

method Canonicalize(ReadOnlySpan<byte>, StrictJsonReaderOptions) #

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

Reads JSON strictly and canonicalizes it.

Parameters

  • utf8Json: The UTF-8 JSON.
  • options: The reader limits; the defaults when not set.

Returns

The canonical bytes and their SHA-256.

Exceptions

namespace StellaOps.Workflow.Contracts.Durability.Execution

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.

enum StartWorkflowDisposition

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.

record StartWorkflowExecutionResultV1

public sealed record StartWorkflowExecutionResultV1 : IContractValidatable

The decision on a durable start request.

Members

MemberKindSummary
StartWorkflowExecutionResultV1()constructorCreates an instance of StartWorkflowExecutionResultV1.
AssociationGenerationpropertyThe generation of the association.
AssociationIdpropertyThe association.
AssociationSha256propertyThe SHA-256 of the association.
ContractVersionpropertyThe contract version: 1.
DecidedAtpropertyWhen the decision was taken.
DispositionpropertyThe decision.
EventIdpropertyThe event identifier.
ExecutionVersionpropertyThe execution version the start created.
FirstEventSequencepropertyThe sequence of the first history event.
RootScopeExecutionIdpropertyThe root scope.
SafeCodepropertyThe safe refusal code, when refused.
StartRequestIdpropertyThe start request.
StartRequestSha256propertyThe SHA-256 of the start request.
WorkflowExecutionIdpropertyThe execution (workflow instance).
Validate()methodChecks the fields.
ValidateAgainst(StartWorkflowExecutionV1)methodChecks that the result answers the request: the same start request, execution and association.

constructor StartWorkflowExecutionResultV1() #

public StartWorkflowExecutionResultV1()

Creates an instance of StartWorkflowExecutionResultV1.

property AssociationGeneration #

public required long AssociationGeneration { get; init; }

The generation of the association.

property AssociationId #

public required string AssociationId { get; init; }

The association.

property AssociationSha256 #

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property DecidedAt #

public required Rfc3339MillisecondInstant DecidedAt { get; init; }

When the decision was taken.

property Disposition #

public required StartWorkflowDisposition Disposition { get; init; }

The decision.

property EventId #

public required string EventId { get; init; }

The event identifier.

property ExecutionVersion #

public required long? ExecutionVersion { get; init; }

The execution version the start created.

property FirstEventSequence #

public required long? FirstEventSequence { get; init; }

The sequence of the first history event.

property RootScopeExecutionId #

public required string RootScopeExecutionId { get; init; }

The root scope.

property SafeCode #

public required string? SafeCode { get; init; }

The safe refusal code, when refused.

property StartRequestId #

public required string StartRequestId { get; init; }

The start request.

property StartRequestSha256 #

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method Validate() #

public void Validate()

Checks the fields.

Exceptions

method ValidateAgainst(StartWorkflowExecutionV1) #

public void ValidateAgainst(StartWorkflowExecutionV1 request)

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

Parameters

  • request: The request.

Exceptions

record StartWorkflowExecutionV1

public sealed record StartWorkflowExecutionV1 : IContractValidatable

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

Members

MemberKindSummary
StartWorkflowExecutionV1()constructorCreates an instance of StartWorkflowExecutionV1.
AssociationGenerationpropertyThe generation of the association.
AssociationIdpropertyThe association.
AssociationSha256propertyThe SHA-256 of the association.
BusinessReferenceSha256propertyThe SHA-256 of the business reference.
CallerIdempotencySha256propertyThe SHA-256 of the caller’s idempotency key.
ContractVersionpropertyThe contract version: 1.
DefinitionCodepropertyThe workflow definition.
DefinitionSha256propertyThe SHA-256 of the definition.
DefinitionVersionpropertyThe definition version.
InputpropertyThe input payload.
PredecessorExecutionIdpropertyThe execution this one continues, when it continues one.
RequestedAtpropertyWhen the start was requested.
RootScopeExecutionIdpropertyThe root scope.
StartRequestIdpropertyThe start request.
WorkflowExecutionIdpropertyThe execution (workflow instance).
ComputeSha256()methodThe SHA-256 of the request’s canonical JSON.
Validate()methodChecks the fields.

constructor StartWorkflowExecutionV1() #

public StartWorkflowExecutionV1()

Creates an instance of StartWorkflowExecutionV1.

property AssociationGeneration #

public required long AssociationGeneration { get; init; }

The generation of the association.

property AssociationId #

public required string AssociationId { get; init; }

The association.

property AssociationSha256 #

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

property BusinessReferenceSha256 #

public required Sha256Hex BusinessReferenceSha256 { get; init; }

The SHA-256 of the business reference.

property CallerIdempotencySha256 #

public required Sha256Hex CallerIdempotencySha256 { get; init; }

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

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property DefinitionCode #

public required string DefinitionCode { get; init; }

The workflow definition.

property DefinitionSha256 #

public required Sha256Hex DefinitionSha256 { get; init; }

The SHA-256 of the definition.

property DefinitionVersion #

public required string DefinitionVersion { get; init; }

The definition version.

property Input #

public required JsonPayloadDescriptorV1 Input { get; init; }

The input payload.

property PredecessorExecutionId #

public required string? PredecessorExecutionId { get; init; }

The execution this one continues, when it continues one.

property RequestedAt #

public required Rfc3339MillisecondInstant RequestedAt { get; init; }

When the start was requested.

property RootScopeExecutionId #

public required string RootScopeExecutionId { get; init; }

The root scope.

property StartRequestId #

public required string StartRequestId { get; init; }

The start request.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method ComputeSha256() #

public Sha256Hex ComputeSha256()

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

Returns

The SHA-256.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

record WorkflowPrestartTerminalAckV1

public sealed record WorkflowPrestartTerminalAckV1 : IContractValidatable

The acknowledgement of a prestart terminal command.

Members

MemberKindSummary
WorkflowPrestartTerminalAckV1()constructorCreates an instance of WorkflowPrestartTerminalAckV1.
AssociationGenerationpropertyThe generation of the association.
AssociationIdpropertyThe association.
AssociationSha256propertyThe SHA-256 of the association.
CleanupDispositionpropertyHow the cleanup was handled.
CommandEventIdpropertyThe command.
CommandSha256propertyThe SHA-256 of the command.
ContractVersionpropertyThe contract version: 1.
DispositionpropertyHow the command was handled.
EventIdpropertyThe event identifier.
LatchDispositionpropertyHow the terminal latch was handled.
OccurredAtpropertyWhen it happened.
RootOutcomepropertyThe outcome of the root execution, when it exists.
SafeCodepropertyThe safe refusal code, when refused.
ScopeExecutionIdpropertyThe root scope.
StartRequestIdpropertyThe start request.
StartRequestSha256propertyThe SHA-256 of the start request.
TerminalFenceIdpropertyThe terminal fence.
TerminalFenceSha256propertyThe SHA-256 of the fence.
TerminalFenceVersionpropertyThe fence version.
TerminalModepropertyThe terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.
WorkflowExecutionIdpropertyThe execution (workflow instance).
Validate()methodChecks the fields.
ValidateAgainst(WorkflowPrestartTerminalCommandV1)methodChecks that the acknowledgement answers the command.

constructor WorkflowPrestartTerminalAckV1() #

public WorkflowPrestartTerminalAckV1()

Creates an instance of WorkflowPrestartTerminalAckV1.

property AssociationGeneration #

public required long AssociationGeneration { get; init; }

The generation of the association.

property AssociationId #

public required string AssociationId { get; init; }

The association.

property AssociationSha256 #

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

property CleanupDisposition #

public required string CleanupDisposition { get; init; }

How the cleanup was handled.

property CommandEventId #

public required string CommandEventId { get; init; }

The command.

property CommandSha256 #

public required Sha256Hex CommandSha256 { get; init; }

The SHA-256 of the command.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property Disposition #

public required string Disposition { get; init; }

How the command was handled.

property EventId #

public required string EventId { get; init; }

The event identifier.

property LatchDisposition #

public required string LatchDisposition { get; init; }

How the terminal latch was handled.

property OccurredAt #

public required Rfc3339MillisecondInstant OccurredAt { get; init; }

When it happened.

property RootOutcome #

public required string? RootOutcome { get; init; }

The outcome of the root execution, when it exists.

property SafeCode #

public required string? SafeCode { get; init; }

The safe refusal code, when refused.

property ScopeExecutionId #

public required string ScopeExecutionId { get; init; }

The root scope.

property StartRequestId #

public required string StartRequestId { get; init; }

The start request.

property StartRequestSha256 #

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

property TerminalFenceId #

public required string TerminalFenceId { get; init; }

The terminal fence.

property TerminalFenceSha256 #

public required Sha256Hex TerminalFenceSha256 { get; init; }

The SHA-256 of the fence.

property TerminalFenceVersion #

public required long TerminalFenceVersion { get; init; }

The fence version.

property TerminalMode #

public required string TerminalMode { get; init; }

The terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method Validate() #

public void Validate()

Checks the fields.

Exceptions

method ValidateAgainst(WorkflowPrestartTerminalCommandV1) #

public void ValidateAgainst(WorkflowPrestartTerminalCommandV1 command)

Checks that the acknowledgement answers the command.

Parameters

  • command: The command.

Exceptions

record WorkflowPrestartTerminalCommandV1

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.

Members

MemberKindSummary
WorkflowPrestartTerminalCommandV1()constructorCreates an instance of WorkflowPrestartTerminalCommandV1.
AssociationGenerationpropertyThe generation of the association.
AssociationIdpropertyThe association.
AssociationSha256propertyThe SHA-256 of the association.
ContractVersionpropertyThe contract version: 1.
EventIdpropertyThe event identifier.
OccurredAtpropertyWhen it happened.
ScopeExecutionIdpropertyThe root scope.
StartRequestIdpropertyThe start request.
StartRequestSha256propertyThe SHA-256 of the start request.
TerminalFenceIdpropertyThe terminal fence.
TerminalFenceSha256propertyThe SHA-256 of the fence.
TerminalFenceVersionpropertyThe fence version.
TerminalModepropertyThe terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.
WorkflowExecutionIdpropertyThe execution (workflow instance).
Validate()methodChecks the fields.

constructor WorkflowPrestartTerminalCommandV1() #

public WorkflowPrestartTerminalCommandV1()

Creates an instance of WorkflowPrestartTerminalCommandV1.

property AssociationGeneration #

public required long AssociationGeneration { get; init; }

The generation of the association.

property AssociationId #

public required string AssociationId { get; init; }

The association.

property AssociationSha256 #

public required Sha256Hex AssociationSha256 { get; init; }

The SHA-256 of the association.

property ContractVersion #

public required int ContractVersion { get; init; }

The contract version: 1.

property EventId #

public required string EventId { get; init; }

The event identifier.

property OccurredAt #

public required Rfc3339MillisecondInstant OccurredAt { get; init; }

When it happened.

property ScopeExecutionId #

public required string ScopeExecutionId { get; init; }

The root scope.

property StartRequestId #

public required string StartRequestId { get; init; }

The start request.

property StartRequestSha256 #

public required Sha256Hex StartRequestSha256 { get; init; }

The SHA-256 of the start request.

property TerminalFenceId #

public required string TerminalFenceId { get; init; }

The terminal fence.

property TerminalFenceSha256 #

public required Sha256Hex TerminalFenceSha256 { get; init; }

The SHA-256 of the fence.

property TerminalFenceVersion #

public required long TerminalFenceVersion { get; init; }

The fence version.

property TerminalMode #

public required string TerminalMode { get; init; }

The terminal mode: BUSINESS_CANCELED or EXTERNALLY_FINALIZED.

property WorkflowExecutionId #

public required string WorkflowExecutionId { get; init; }

The execution (workflow instance).

method Validate() #

public void Validate()

Checks the fields.

Exceptions

namespace StellaOps.Workflow.Contracts.Durability.Payloads

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.

enum DataSensitivity

public enum DataSensitivity

The sensitivity of a payload.

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

class JsonArtifactContentReferenceV1

public static class JsonArtifactContentReferenceV1

The artifact content reference of payloads.

Members

MemberKindSummary
DescriptorPropertyNameconstantThe property name of the artifact content reference: stellaOpsArtifactContentV1.

constant DescriptorPropertyName #

public const string DescriptorPropertyName = "stellaOpsArtifactContentV1"

The property name of the artifact content reference: stellaOpsArtifactContentV1.

record JsonPayloadDescriptorV1

public sealed record JsonPayloadDescriptorV1 : IContractValidatable

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

Members

MemberKindSummary
JsonPayloadDescriptorV1()constructorCreates an instance of JsonPayloadDescriptorV1.
ArtifactRefpropertyThe artifact reference, for an artifact payload: printable ASCII, at most 512 characters.
ByteLengthpropertyThe length of the canonical JSON.
CanonicalizationpropertyThe canonicalization: WorkflowJcsV1.Name.
CompressionpropertyThe compression: NONE.
DescriptorVersionpropertyThe descriptor version: 1.
InlineJsonpropertyThe JSON, for an inline payload.
MediaTypepropertyThe media type: application/json.
SchemaIdpropertyThe schema of the JSON.
SchemaVersionpropertyThe schema version, from 1.
SensitivitypropertyThe sensitivity.
Sha256propertyThe SHA-256 of the canonical JSON.
TransportpropertyWhether the JSON is inline or in an artifact.
Validate()methodChecks the fields.

constructor JsonPayloadDescriptorV1() #

public JsonPayloadDescriptorV1()

Creates an instance of JsonPayloadDescriptorV1.

property ArtifactRef #

public string? ArtifactRef { get; init; }

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

property ByteLength #

public required long ByteLength { get; init; }

The length of the canonical JSON.

property Canonicalization #

public required string Canonicalization { get; init; }

The canonicalization: WorkflowJcsV1.Name.

property Compression #

public required string Compression { get; init; }

The compression: NONE.

property DescriptorVersion #

public required int DescriptorVersion { get; init; }

The descriptor version: 1.

property InlineJson #

public JsonElement InlineJson { get; init; }

The JSON, for an inline payload.

property MediaType #

public required string MediaType { get; init; }

The media type: application/json.

property SchemaId #

public required string SchemaId { get; init; }

The schema of the JSON.

property SchemaVersion #

public required int SchemaVersion { get; init; }

The schema version, from 1.

property Sensitivity #

public required DataSensitivity Sensitivity { get; init; }

The sensitivity.

property Sha256 #

public required Sha256Hex Sha256 { get; init; }

The SHA-256 of the canonical JSON.

property Transport #

public required JsonPayloadTransport Transport { get; init; }

Whether the JSON is inline or in an artifact.

method Validate() #

public void Validate()

Checks the fields.

Exceptions

enum JsonPayloadTransport

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.

namespace StellaOps.Workflow.Contracts.Durability.Scalars

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.

struct ConfidenceBasisPoints

public readonly struct ConfidenceBasisPoints : IEquatable<ConfidenceBasisPoints>

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

Members

MemberKindSummary
ConfidenceBasisPoints(int)constructorCreates a confidence.
ValuepropertyThe basis points.
ToString()methodReturns the basis points as invariant text.

constructor ConfidenceBasisPoints(int) #

public ConfidenceBasisPoints(int value)

Creates a confidence.

Parameters

  • value: The basis points.

Exceptions

  • ArgumentOutOfRangeException: The value is outside 0 to 10000.

property Value #

public int Value { get; }

The basis points.

method ToString() #

public override string ToString()

Returns the basis points as invariant text.

Returns

The text.

class ConfidenceBasisPointsJsonConverter

public sealed class ConfidenceBasisPointsJsonConverter : JsonConverter<ConfidenceBasisPoints>

Reads and writes a confidence as a JSON number.

Members

MemberKindSummary
ConfidenceBasisPointsJsonConverter()constructorCreates an instance of ConfidenceBasisPointsJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the confidence from a JSON number.
Write(Utf8JsonWriter, ConfidenceBasisPoints, JsonSerializerOptions)methodWrites the confidence as a JSON number.

constructor ConfidenceBasisPointsJsonConverter() #

public ConfidenceBasisPointsJsonConverter()

Creates an instance of ConfidenceBasisPointsJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the confidence from a JSON number.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, ConfidenceBasisPoints, JsonSerializerOptions) #

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

Writes the confidence as a JSON number.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct DecimalString

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.

Members

MemberKindSummary
DecimalValuepropertyThe value.
ScalepropertyThe digits after the decimal point.
ValuepropertyThe canonical text.
EnsureMaximumScale(int)methodChecks the scale.
Parse(string)methodParses canonical text with at most 28 decimals.
Parse(string, int)methodParses canonical text with at most maximumScale decimals.
ParseMoney(string)methodParses an amount of money: at most 4 decimals.
ParseQuantity(string)methodParses a quantity: at most 6 decimals.
ParseRate(string)methodParses a rate: at most 8 decimals.
ToString()methodReturns the canonical text.

property DecimalValue #

public decimal DecimalValue { get; }

The value.

property Scale #

public int Scale { get; }

The digits after the decimal point.

property Value #

public string Value { get; }

The canonical text.

method EnsureMaximumScale(int) #

public DecimalString EnsureMaximumScale(int maximumScale)

Checks the scale.

Parameters

  • maximumScale: The most decimals allowed.

Returns

The same value.

Exceptions

  • FormatException: The value has more decimals.

method Parse(string) #

public static DecimalString Parse(string value)

Parses canonical text with at most 28 decimals.

Parameters

  • value: The text.

Returns

The decimal string.

Exceptions

  • FormatException: The text is not valid.

method Parse(string, int) #

public static DecimalString Parse(string value, int maximumScale)

Parses canonical text with at most maximumScale decimals.

Parameters

  • value: The text.
  • maximumScale: The most decimals allowed, from 0 to 28.

Returns

The decimal string.

Exceptions

  • FormatException: The text is not valid.
  • ArgumentOutOfRangeException: maximumScale is outside 0 to 28.

method ParseMoney(string) #

public static DecimalString ParseMoney(string value)

Parses an amount of money: at most 4 decimals.

Parameters

  • value: The text.

Returns

The decimal string.

Exceptions

  • FormatException: The text is not valid.

method ParseQuantity(string) #

public static DecimalString ParseQuantity(string value)

Parses a quantity: at most 6 decimals.

Parameters

  • value: The text.

Returns

The decimal string.

Exceptions

  • FormatException: The text is not valid.

method ParseRate(string) #

public static DecimalString ParseRate(string value)

Parses a rate: at most 8 decimals.

Parameters

  • value: The text.

Returns

The decimal string.

Exceptions

  • FormatException: The text is not valid.

method ToString() #

public override string ToString()

Returns the canonical text.

Returns

The text.

class DecimalStringJsonConverter

public sealed class DecimalStringJsonConverter : JsonConverter<DecimalString>

Reads and writes a decimal string as a JSON string.

Members

MemberKindSummary
DecimalStringJsonConverter()constructorCreates an instance of DecimalStringJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the decimal string from a JSON string.
Write(Utf8JsonWriter, DecimalString, JsonSerializerOptions)methodWrites the decimal string as a JSON string.

constructor DecimalStringJsonConverter() #

public DecimalStringJsonConverter()

Creates an instance of DecimalStringJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the decimal string from a JSON string.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, DecimalString, JsonSerializerOptions) #

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

Writes the decimal string as a JSON string.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct GregorianDate

public readonly struct GregorianDate : IEquatable<GregorianDate>

A Gregorian date as YYYY-MM-DD text.

Members

MemberKindSummary
DatepropertyThe date.
ValuepropertyThe text.
Parse(string)methodParses YYYY-MM-DD text.
ToString()methodReturns the canonical text.

property Date #

public DateOnly Date { get; }

The date.

property Value #

public string Value { get; }

The text.

method Parse(string) #

public static GregorianDate Parse(string value)

Parses YYYY-MM-DD text.

Parameters

  • value: The text.

Returns

The date.

Exceptions

  • FormatException: The text is not valid.

method ToString() #

public override string ToString()

Returns the canonical text.

Returns

The text.

class GregorianDateJsonConverter

public sealed class GregorianDateJsonConverter : JsonConverter<GregorianDate>

Reads and writes a date as a JSON string.

Members

MemberKindSummary
GregorianDateJsonConverter()constructorCreates an instance of GregorianDateJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the date from a JSON string.
Write(Utf8JsonWriter, GregorianDate, JsonSerializerOptions)methodWrites the date as a JSON string.

constructor GregorianDateJsonConverter() #

public GregorianDateJsonConverter()

Creates an instance of GregorianDateJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the date from a JSON string.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, GregorianDate, JsonSerializerOptions) #

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

Writes the date as a JSON string.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct Iso4217Code

public readonly struct Iso4217Code : IEquatable<Iso4217Code>

An ISO 4217 currency code: three uppercase ASCII letters.

Members

MemberKindSummary
Iso4217Code(string)constructorCreates a currency code.
ValuepropertyThe code.
Parse(string)methodParses a currency code.
ToString()methodReturns the canonical text.

constructor Iso4217Code(string) #

public Iso4217Code(string value)

Creates a currency code.

Parameters

  • value: The code.

Exceptions

  • FormatException: The text is not valid.

property Value #

public string Value { get; }

The code.

method Parse(string) #

public static Iso4217Code Parse(string value)

Parses a currency code.

Parameters

  • value: The text.

Returns

The code.

Exceptions

  • FormatException: The text is not valid.

method ToString() #

public override string ToString()

Returns the canonical text.

Returns

The text.

class Iso4217CodeJsonConverter

public sealed class Iso4217CodeJsonConverter : JsonConverter<Iso4217Code>

Reads and writes a currency code as a JSON string.

Members

MemberKindSummary
Iso4217CodeJsonConverter()constructorCreates an instance of Iso4217CodeJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the currency code from a JSON string.
Write(Utf8JsonWriter, Iso4217Code, JsonSerializerOptions)methodWrites the currency code as a JSON string.

constructor Iso4217CodeJsonConverter() #

public Iso4217CodeJsonConverter()

Creates an instance of Iso4217CodeJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the currency code from a JSON string.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, Iso4217Code, JsonSerializerOptions) #

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

Writes the currency code as a JSON string.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct NormalizedCoordinate

public readonly struct NormalizedCoordinate : IEquatable<NormalizedCoordinate>

A coordinate normalized to the range 0 to 1000000.

Members

MemberKindSummary
NormalizedCoordinate(int)constructorCreates a coordinate.
ValuepropertyThe coordinate.
ToString()methodReturns the coordinate as invariant text.

constructor NormalizedCoordinate(int) #

public NormalizedCoordinate(int value)

Creates a coordinate.

Parameters

  • value: The coordinate.

Exceptions

  • ArgumentOutOfRangeException: The value is outside 0 to 1000000.

property Value #

public int Value { get; }

The coordinate.

method ToString() #

public override string ToString()

Returns the coordinate as invariant text.

Returns

The text.

class NormalizedCoordinateJsonConverter

public sealed class NormalizedCoordinateJsonConverter : JsonConverter<NormalizedCoordinate>

Reads and writes a normalized coordinate as a JSON number.

Members

MemberKindSummary
NormalizedCoordinateJsonConverter()constructorCreates an instance of NormalizedCoordinateJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the coordinate from a JSON number.
Write(Utf8JsonWriter, NormalizedCoordinate, JsonSerializerOptions)methodWrites the coordinate as a JSON number.

constructor NormalizedCoordinateJsonConverter() #

public NormalizedCoordinateJsonConverter()

Creates an instance of NormalizedCoordinateJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the coordinate from a JSON number.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, NormalizedCoordinate, JsonSerializerOptions) #

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

Writes the coordinate as a JSON number.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct Rfc3339MillisecondInstant

public readonly struct Rfc3339MillisecondInstant : IEquatable<Rfc3339MillisecondInstant>

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

Members

MemberKindSummary
FormatconstantThe text format: yyyy-MM-ddTHH:mm:ss.fffZ.
InstantpropertyThe instant.
ValuepropertyThe text.
FromDateTimeOffset(DateTimeOffset)methodConverts an instant with exact millisecond precision to UTC text.
Parse(string)methodParses the text format.
ToString()methodReturns the canonical text.

constant Format #

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

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

property Instant #

public DateTimeOffset Instant { get; }

The instant.

property Value #

public string Value { get; }

The text.

method FromDateTimeOffset(DateTimeOffset) #

public static Rfc3339MillisecondInstant FromDateTimeOffset(DateTimeOffset value)

Converts an instant with exact millisecond precision to UTC text.

Parameters

  • value: The instant.

Returns

The instant.

Exceptions

  • ArgumentException: The instant has sub-millisecond precision.

method Parse(string) #

public static Rfc3339MillisecondInstant Parse(string value)

Parses the text format.

Parameters

  • value: The text.

Returns

The instant.

Exceptions

  • FormatException: The text is not valid.

method ToString() #

public override string ToString()

Returns the canonical text.

Returns

The text.

class Rfc3339MillisecondInstantJsonConverter

public sealed class Rfc3339MillisecondInstantJsonConverter : JsonConverter<Rfc3339MillisecondInstant>

Reads and writes an instant as a JSON string.

Members

MemberKindSummary
Rfc3339MillisecondInstantJsonConverter()constructorCreates an instance of Rfc3339MillisecondInstantJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the instant from a JSON string.
Write(Utf8JsonWriter, Rfc3339MillisecondInstant, JsonSerializerOptions)methodWrites the instant as a JSON string.

constructor Rfc3339MillisecondInstantJsonConverter() #

public Rfc3339MillisecondInstantJsonConverter()

Creates an instance of Rfc3339MillisecondInstantJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the instant from a JSON string.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, Rfc3339MillisecondInstant, JsonSerializerOptions) #

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

Writes the instant as a JSON string.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

struct Sha256Hex

public readonly struct Sha256Hex : IEquatable<Sha256Hex>

A SHA-256 digest as 64 lowercase hexadecimal characters.

Members

MemberKindSummary
Sha256Hex(string)constructorCreates a digest.
ValuepropertyThe hexadecimal text.
FixedTimeEquals(Sha256Hex)methodCompares two digests in constant time.
FromBytes(ReadOnlySpan<byte>)methodCreates a digest from its 32 bytes.
Parse(string)methodParses a digest.
ToString()methodReturns the canonical text.
TryParse(string, out Sha256Hex)methodParses a digest.

constructor Sha256Hex(string) #

public Sha256Hex(string value)

Creates a digest.

Parameters

  • value: The hexadecimal text.

Exceptions

  • FormatException: The text is not valid.

property Value #

public string Value { get; }

The hexadecimal text.

method FixedTimeEquals(Sha256Hex) #

public bool FixedTimeEquals(Sha256Hex other)

Compares two digests in constant time.

Parameters

  • other: The other digest.

Returns

Whether they are equal; false when either is empty.

method FromBytes(ReadOnlySpan<byte>) #

public static Sha256Hex FromBytes(ReadOnlySpan<byte> bytes)

Creates a digest from its 32 bytes.

Parameters

  • bytes: The bytes.

Returns

The digest.

Exceptions

  • ArgumentException: There are not exactly 32 bytes.

method Parse(string) #

public static Sha256Hex Parse(string value)

Parses a digest.

Parameters

  • value: The text.

Returns

The digest.

Exceptions

  • FormatException: The text is not valid.

method ToString() #

public override string ToString()

Returns the canonical text.

Returns

The text.

method TryParse(string, out Sha256Hex) #

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

Parses a digest.

Parameters

  • value: The text.
  • result: The digest, when valid.

Returns

Whether it is valid.

class Sha256HexJsonConverter

public sealed class Sha256HexJsonConverter : JsonConverter<Sha256Hex>

Reads and writes a digest as a JSON string.

Members

MemberKindSummary
Sha256HexJsonConverter()constructorCreates an instance of Sha256HexJsonConverter.
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)methodReads the digest from a JSON string.
Write(Utf8JsonWriter, Sha256Hex, JsonSerializerOptions)methodWrites the digest as a JSON string.

constructor Sha256HexJsonConverter() #

public Sha256HexJsonConverter()

Creates an instance of Sha256HexJsonConverter.

method Read(ref Utf8JsonReader, Type, JsonSerializerOptions) #

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

Reads the digest from a JSON string.

Parameters

  • reader: The reader.
  • typeToConvert: The type to convert.
  • options: The serializer options.

Returns

The value.

method Write(Utf8JsonWriter, Sha256Hex, JsonSerializerOptions) #

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

Writes the digest as a JSON string.

Parameters

  • writer: The writer.
  • value: The value.
  • options: The serializer options.

namespace StellaOps.Workflow.Contracts.Durability.Schemas

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

class ContractSchemaValidationException

public sealed class ContractSchemaValidationException : Exception

Raised when a value does not match a frozen schema.

Parameters

  • schemaReference: The schema reference.
  • instanceLocation: Where in the value.
  • message: What does not match.

Members

MemberKindSummary
ContractSchemaValidationException(string, string, string)constructorRaised when a value does not match a frozen schema.
InstanceLocationpropertyWhere in the value.
SchemaReferencepropertyThe schema reference.

constructor ContractSchemaValidationException(string, string, string) #

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

Raised when a value does not match a frozen schema.

Parameters

  • schemaReference: The schema reference.
  • instanceLocation: Where in the value.
  • message: What does not match.

property InstanceLocation #

public string InstanceLocation { get; }

Where in the value.

property SchemaReference #

public string SchemaReference { get; }

The schema reference.

class FrozenContractSchemaSet

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.

Members

MemberKindSummary
SchemaIdspropertyThe schema ids.
V1propertyThe frozen v1 schemas.
GetDescriptor(string)methodReturns the descriptor of a schema.
IsValid(JsonElement, string)methodWhether a value matches a schema.
Validate(JsonElement, string)methodChecks a value against a schema.

property SchemaIds #

public IReadOnlyCollection<string> SchemaIds { get; }

The schema ids.

property V1 #

public static FrozenContractSchemaSet V1 { get; }

The frozen v1 schemas.

method GetDescriptor(string) #

public FrozenSchemaDescriptor GetDescriptor(string schemaId)

Returns the descriptor of a schema.

Parameters

  • schemaId: The schema id.

Returns

The descriptor.

Exceptions

  • ArgumentOutOfRangeException: The schema is not in the set.

method IsValid(JsonElement, string) #

public bool IsValid(JsonElement instance, string schemaReference)

Whether a value matches a schema.

Parameters

  • instance: The value.
  • schemaReference: The schema reference.

Returns

Whether it matches.

method Validate(JsonElement, string) #

public void Validate(JsonElement instance, string schemaReference)

Checks a value against a schema.

Parameters

  • instance: The value.
  • schemaReference: The schema reference.

Exceptions

record FrozenSchemaDescriptor

public sealed record FrozenSchemaDescriptor

A frozen schema.

Parameters

  • SchemaId: The schema id.
  • Sha256: The SHA-256 of its canonical JSON.
  • CanonicalByteLength: The length of its canonical JSON.

Members

MemberKindSummary
FrozenSchemaDescriptor(string, Sha256Hex, int)constructorA frozen schema.
CanonicalByteLengthpropertyThe length of its canonical JSON.
SchemaIdpropertyThe schema id.
Sha256propertyThe SHA-256 of its canonical JSON.

constructor FrozenSchemaDescriptor(string, Sha256Hex, int) #

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

A frozen schema.

Parameters

  • SchemaId: The schema id.
  • Sha256: The SHA-256 of its canonical JSON.
  • CanonicalByteLength: The length of its canonical JSON.

property CanonicalByteLength #

public int CanonicalByteLength { get; init; }

The length of its canonical JSON.

property SchemaId #

public string SchemaId { get; init; }

The schema id.

property Sha256 #

public Sha256Hex Sha256 { get; init; }

The SHA-256 of its canonical JSON.

namespace StellaOps.Workflow.Contracts.Durability.Serialization

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

class ContractJsonCodec

public static class ContractJsonCodec

Reads and writes the durable contracts as canonical JSON.

Members

MemberKindSummary
ComputeSha256<T>(T)methodThe SHA-256 of a contract’s canonical JSON.
ComputeValueSha256<T>(T)methodThe SHA-256 of any value’s canonical JSON.
CreateIsolatedSerializerOptions()methodA copy of the contract serializer options.
Decode<T>(ReadOnlySpan<byte>, StrictJsonReaderOptions)methodReads a contract strictly and canonically, then checks its fields.
DecodeUnchecked<T>(ReadOnlySpan<byte>, StrictJsonReaderOptions)methodReads a contract strictly and canonically, without checking its fields.
DecodeWithSchema<T>(ReadOnlySpan<byte>, string, StrictJsonReaderOptions)methodReads a contract strictly and canonically and checks it against a frozen schema.
Encode<T>(T)methodChecks a contract’s fields and writes it as canonical JSON.
EncodeValue<T>(T)methodWrites any value as canonical JSON.

method ComputeSha256<T>(T) #

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

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

Type parameters

  • T: The contract type.

Parameters

  • value: The contract.

Returns

The SHA-256.

method ComputeValueSha256<T>(T) #

public static Sha256Hex ComputeValueSha256<T>(T value)

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

Type parameters

  • T: The value type.

Parameters

  • value: The value.

Returns

The SHA-256.

method CreateIsolatedSerializerOptions() #

public static JsonSerializerOptions CreateIsolatedSerializerOptions()

A copy of the contract serializer options.

Returns

The options.

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

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

  • T: The contract type.

Parameters

  • utf8Json: The UTF-8 JSON.
  • readerOptions: The reader limits; the defaults when not set.

Returns

The contract and its canonical JSON.

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

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

  • T: The contract type.

Parameters

  • utf8Json: The UTF-8 JSON.
  • readerOptions: The reader limits; the defaults when not set.

Returns

The contract and its canonical JSON.

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

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

  • T: The contract type.

Parameters

  • utf8Json: The UTF-8 JSON.
  • schemaReference: The schema reference.
  • readerOptions: The reader limits; the defaults when not set.

Returns

The contract and its canonical JSON.

method Encode<T>(T) #

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

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

Type parameters

  • T: The contract type.

Parameters

  • value: The contract.

Returns

The canonical JSON.

method EncodeValue<T>(T) #

public static CanonicalJsonResult EncodeValue<T>(T value)

Writes any value as canonical JSON.

Type parameters

  • T: The value type.

Parameters

  • value: The value.

Returns

The canonical JSON.

record DecodedContract<T>

public sealed record DecodedContract<T>

A decoded contract with its canonical JSON.

Type parameters

  • T: The contract type.

Parameters

  • Value: The contract.
  • CanonicalJson: Its canonical JSON.

Members

MemberKindSummary
DecodedContract(T, CanonicalJsonResult)constructorA decoded contract with its canonical JSON.
CanonicalJsonpropertyIts canonical JSON.
ValuepropertyThe contract.

constructor DecodedContract(T, CanonicalJsonResult) #

public DecodedContract(T Value, CanonicalJsonResult CanonicalJson)

A decoded contract with its canonical JSON.

Type parameters

  • T: The contract type.

Parameters

  • Value: The contract.
  • CanonicalJson: Its canonical JSON.

property CanonicalJson #

public CanonicalJsonResult CanonicalJson { get; init; }

Its canonical JSON.

property Value #

public T Value { get; init; }

The contract.

namespace StellaOps.Workflow.Contracts.Durability.Validation

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.

class ContractValidation

public static class ContractValidation

The field rules of the durable contracts.

Members

MemberKindSummary
MaximumSafeIntegerconstantThe largest integer a JSON number carries exactly: 2^53 - 1.
Require(bool, string, string)methodRaises a validation error when a condition fails.
RequireCallerNamespace(string, string)methodRequires a caller namespace: 3 to 128 lowercase letters, digits, _, . or -, starting with a letter (CONTRACT_CALLER_NAMESPACE_INVALID).
RequireCode(string, string)methodRequires a code: 1 to 128 uppercase letters, digits, _, . or -, starting with a letter (CONTRACT_CODE_INVALID).
RequireContractVersion(int, string)methodRequires contract version 1 (CONTRACT_VERSION_UNSUPPORTED).
RequireExecutionId(string, string)methodRequires an execution id: 8 to 128 letters, digits, ., _, : or -, starting with a letter or digit (CONTRACT_EXECUTION_ID_INVALID).
RequireOpaqueAscii(string, int, string)methodRequires printable ASCII without spaces, 1 to maximumLength characters (CONTRACT_OPAQUE_ASCII_INVALID).
RequireSafeNonNegative(long, string)methodRequires an integer from 0 to ContractValidation.MaximumSafeInteger(CONTRACT_SAFE_INTEGER_INVALID).
RequireSafePositive(long, string)methodRequires an integer from 1 to ContractValidation.MaximumSafeInteger(CONTRACT_SAFE_INTEGER_INVALID).
RequireSchemaId(string, string)methodRequires a schema id: 3 to 200 characters, path segments of lowercase letters, digits, ., _ or - (PAYLOAD_SCHEMA_ID_INVALID).
RequireVersion(string, string)methodRequires a version text: 1 to 100 letters, digits, ., _, + or -, starting with a letter or digit (CONTRACT_VERSION_TEXT_INVALID).

constant MaximumSafeInteger #

public const long MaximumSafeInteger = 9007199254740991

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

method Require(bool, string, string) #

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

Raises a validation error when a condition fails.

Parameters

  • condition: The condition.
  • code: The error code.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireCallerNamespace(string, string) #

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

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireCode(string, string) #

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

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireContractVersion(int, string) #

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

Requires contract version 1 (CONTRACT_VERSION_UNSUPPORTED).

Parameters

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireExecutionId(string, string) #

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

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireOpaqueAscii(string, int, string) #

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

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

Parameters

  • value: The value.
  • maximumLength: The longest length.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireSafeNonNegative(long, string) #

public static void RequireSafeNonNegative(long value, string pointer)

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

Parameters

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireSafePositive(long, string) #

public static void RequireSafePositive(long value, string pointer)

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

Parameters

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireSchemaId(string, string) #

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

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

method RequireVersion(string, string) #

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

  • value: The value.
  • pointer: The JSON pointer of the value, for the error.

Exceptions

class ContractValidationException

public sealed class ContractValidationException : Exception

Raised when a durable contract field breaks its rule.

Members

MemberKindSummary
ContractValidationException(string, string)constructorCreates the exception.
CodepropertyThe error code.
JsonPointerpropertyThe JSON pointer of the field.

constructor ContractValidationException(string, string) #

public ContractValidationException(string code, string jsonPointer)

Creates the exception.

Parameters

  • code: The error code.
  • jsonPointer: The JSON pointer of the field.

property Code #

public string Code { get; }

The error code.

property JsonPointer #

public string JsonPointer { get; }

The JSON pointer of the field.

interface IContractValidatable

public interface IContractValidatable

A durable contract that checks its own fields.

Members

MemberKindSummary
Validate()methodChecks the fields.

method Validate() #

void Validate()

Checks the fields.

Exceptions