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.
| Package | StellaOps.Workflow.Contracts.Durability |
| Component | Workflow |
| Licence | BUSL-1.1 (Workflow licence) |
| Package kind | Library |
| Target framework | net10.0 |
To add the package to a project, see Installing Stella Ops packages.
Namespaces
StellaOps.Workflow.Contracts.Durability.Activities namespace
| Type | Kind | Description |
|---|---|---|
WorkflowActivityCancelActiveAttemptV1 | record | The attempt a cancel stops. |
WorkflowActivityCancelContinuationLineageV1 | record | The continuation a cancel revokes. |
WorkflowActivityCancelV1 | record | Sent on the cancel lane when an operator or a deadline stops a step whose attempt may still run. |
WorkflowActivityCompletionContinuationV1 | record | A continuation the handler reports, for the next attempt to resume. |
WorkflowActivityCompletionV1 | record | The handler’s answer on the completion lane, bound to the exact request it answers. |
WorkflowActivityFailureV1 | record | Why an activity attempt failed. |
WorkflowActivityOutcome | enum | The outcome of an activity attempt. |
WorkflowActivityRequestContinuationV1 | record | The continuation a retry resumes: the prior attempt’s completion and its continuation. |
WorkflowActivityRequestV1 | record | 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. |
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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
ValidateAgainst(WorkflowActivityRequestV1) method
public void ValidateAgainst(WorkflowActivityRequestV1 request)
Checks that the completion answers the request.
Parameters
request: The request.
Exceptions
ContractValidationException: It does not answer the request.
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
ContractValidationException: A field breaks its rule.
WorkflowActivityOutcome enum
public enum WorkflowActivityOutcome
The outcome of an activity attempt.
| Value | Description |
|---|---|
SUCCEEDED = 0 | Succeeded. |
RETRYABLE = 1 | Failed; a retry may succeed. |
PERMANENT_FAILURE = 2 | Failed; a retry would fail too. |
CANCELED = 3 | Canceled. |
DEADLINE_EXCEEDED = 4 | Ran 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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
ValidateContinuationOf(WorkflowActivityCompletionV1) method
public void ValidateContinuationOf(WorkflowActivityCompletionV1 priorCompletion)
Checks that the request resumes the continuation of a prior completion.
Parameters
priorCompletion: The prior completion.
Exceptions
ContractValidationException: It does not.
StellaOps.Workflow.Contracts.Durability.CanonicalJson namespace
| Type | Kind | Description |
|---|---|---|
CanonicalJsonErrorCodes | class | The error codes of the strict JSON reader and the canonicalizer. |
CanonicalJsonException | class | Raised when JSON breaks the strict reading or canonicalization rules; its message carries only the code, the pointer and the limit. |
CanonicalJsonResult | class | Canonical JSON bytes with their root kind and SHA-256. |
StrictJsonReadResult | record | What the strict reader saw. |
StrictJsonReader | class | 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. |
StrictJsonReaderOptions | record | Limits of the strict JSON reader that reads canonical durable JSON; every limit must be positive. |
WorkflowJcsV1 | class | The 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: The error code; seeCanonicalJsonErrorCodes.jsonPointer: The JSON pointer of the value.limitName: The limit exceeded, when one was.innerException: The cause.
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
expectedByteLength: The expected length.expectedSha256: The expected SHA-256.
Exceptions
CanonicalJsonException: The length or the hash differs.
StrictJsonReadResult record
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.
StrictJsonReadResult(JsonValueKind, int, int, int) constructor
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.
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
utf8Json: The UTF-8 JSON.options: The reader limits; the defaults when not set.
Returns
What the reader saw.
Exceptions
CanonicalJsonException: The JSON breaks a rule.
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
utf8Json: The UTF-8 JSON.options: The reader limits; the defaults when not set.
Returns
The canonical bytes and their SHA-256.
Exceptions
CanonicalJsonException: The JSON breaks a rule.
StellaOps.Workflow.Contracts.Durability.Execution namespace
| Type | Kind | Description |
|---|---|---|
StartWorkflowDisposition | enum | The decision on a durable start request. |
StartWorkflowExecutionResultV1 | record | The decision on a durable start request. |
StartWorkflowExecutionV1 | record | A durable start request: the execution to create, its definition, business reference, caller idempotency, association and input. |
WorkflowPrestartTerminalAckV1 | record | The acknowledgement of a prestart terminal command. |
WorkflowPrestartTerminalCommandV1 | record | A 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.
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
ContractValidationException: A field breaks its rule.
ValidateAgainst(StartWorkflowExecutionV1) method
public void ValidateAgainst(StartWorkflowExecutionV1 request)
Checks that the result answers the request: the same start request, execution and association.
Parameters
request: The request.
Exceptions
ContractValidationException: The result does not answer the request.
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
ContractValidationException: A field breaks its rule.
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
ContractValidationException: A field breaks its rule.
ValidateAgainst(WorkflowPrestartTerminalCommandV1) method
public void ValidateAgainst(WorkflowPrestartTerminalCommandV1 command)
Checks that the acknowledgement answers the command.
Parameters
command: The command.
Exceptions
ContractValidationException: It does not answer the command.
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
ContractValidationException: A field breaks its rule.
StellaOps.Workflow.Contracts.Durability.Payloads namespace
| Type | Kind | Description |
|---|---|---|
DataSensitivity | enum | The sensitivity of a payload. |
JsonArtifactContentReferenceV1 | class | The artifact content reference of payloads. |
JsonPayloadDescriptorV1 | record | A JSON payload, inline or in an artifact store, with its schema, canonical hash, length and sensitivity. |
JsonPayloadTransport | enum | Where a payload’s JSON travels. |
DataSensitivity enum
public enum DataSensitivity
The sensitivity of a payload.
| Value | Description |
|---|---|
PUBLIC = 0 | Public. |
INTERNAL = 1 | Internal. |
CONFIDENTIAL = 2 | Confidential. |
RESTRICTED = 3 | Restricted. |
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
ContractValidationException: A field breaks its rule.
JsonPayloadTransport enum
public enum JsonPayloadTransport
Where a payload’s JSON travels.
| Value | Description |
|---|---|
INLINE = 0 | The JSON is in the descriptor. |
ARTIFACT = 1 | The JSON is in an artifact store. |
StellaOps.Workflow.Contracts.Durability.Scalars namespace
| Type | Kind | Description |
|---|---|---|
ConfidenceBasisPoints | struct | A confidence in basis points: 0 to 10000 (100%). |
ConfidenceBasisPointsJsonConverter | class | Reads and writes a confidence as a JSON number. |
DecimalString | struct | An exact decimal in canonical text: an optional minus, no leading zeros, and a fraction without trailing zeros; no negative zero. |
DecimalStringJsonConverter | class | Reads and writes a decimal string as a JSON string. |
GregorianDate | struct | A Gregorian date as YYYY-MM-DD text. |
GregorianDateJsonConverter | class | Reads and writes a date as a JSON string. |
Iso4217Code | struct | An ISO 4217 currency code: three uppercase ASCII letters. |
Iso4217CodeJsonConverter | class | Reads and writes a currency code as a JSON string. |
NormalizedCoordinate | struct | A coordinate normalized to the range 0 to 1000000. |
NormalizedCoordinateJsonConverter | class | Reads and writes a normalized coordinate as a JSON number. |
Rfc3339MillisecondInstant | struct | A UTC instant as RFC 3339 text with exactly millisecond precision. |
Rfc3339MillisecondInstantJsonConverter | class | Reads and writes an instant as a JSON string. |
Sha256Hex | struct | A SHA-256 digest as 64 lowercase hexadecimal characters. |
Sha256HexJsonConverter | class | Reads 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
value: The basis points.
Exceptions
ArgumentOutOfRangeException: The value is outside 0 to 10000.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
maximumScale: The most decimals allowed.
Returns
The same value.
Exceptions
FormatException: The value has more decimals.
Parse(string) method
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.
Parse(string, int) method
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:maximumScaleis outside 0 to 28.
ParseMoney(string) method
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.
ParseQuantity(string) method
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.
ParseRate(string) method
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.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
value: The text.
Returns
The date.
Exceptions
FormatException: The text is not valid.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
value: The code.
Exceptions
FormatException: The text is not valid.
Value property
public string Value { get; }
The code.
Parse(string) method
public static Iso4217Code Parse(string value)
Parses a currency code.
Parameters
value: The text.
Returns
The code.
Exceptions
FormatException: The text is not valid.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
value: The coordinate.
Exceptions
ArgumentOutOfRangeException: The value is outside 0 to 1000000.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
value: The instant.
Returns
The instant.
Exceptions
ArgumentException: The instant has sub-millisecond precision.
Parse(string) method
public static Rfc3339MillisecondInstant Parse(string value)
Parses the text format.
Parameters
value: The text.
Returns
The instant.
Exceptions
FormatException: The text is not valid.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
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
value: The hexadecimal text.
Exceptions
FormatException: The text is not valid.
Value property
public string Value { get; }
The hexadecimal text.
FixedTimeEquals(Sha256Hex) method
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.
FromBytes(ReadOnlySpan<byte>) method
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.
Parse(string) method
public static Sha256Hex Parse(string value)
Parses a digest.
Parameters
value: The text.
Returns
The digest.
Exceptions
FormatException: The text is not valid.
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
value: The text.result: The digest, when valid.
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
reader: The reader.typeToConvert: The type to convert.options: The serializer options.
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
writer: The writer.value: The value.options: The serializer options.
StellaOps.Workflow.Contracts.Durability.Schemas namespace
| Type | Kind | Description |
|---|---|---|
ContractSchemaValidationException | class | Raised when a value does not match a frozen schema. |
FrozenContractSchemaSet | class | Immutable in-assembly copy of the frozen v1 contract schemas. |
FrozenSchemaDescriptor | record | A frozen schema. |
ContractSchemaValidationException class
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.
ContractSchemaValidationException(string, string, string) constructor
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.
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
schemaId: The schema id.
Returns
The descriptor.
Exceptions
ArgumentOutOfRangeException: The schema is not in the set.
IsValid(JsonElement, string) method
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.
Validate(JsonElement, string) method
public void Validate(JsonElement instance, string schemaReference)
Checks a value against a schema.
Parameters
instance: The value.schemaReference: The schema reference.
Exceptions
ContractSchemaValidationException: The value does not match.
FrozenSchemaDescriptor record
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.
FrozenSchemaDescriptor(string, Sha256Hex, int) constructor
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.
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
| Type | Kind | Description |
|---|---|---|
ContractJsonCodec | class | Reads and writes the durable contracts as canonical JSON. |
DecodedContract<T> | record | A 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
T: The contract type.
Parameters
value: The contract.
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
T: The value type.
Parameters
value: The value.
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
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.
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
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.
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
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.
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
T: The contract type.
Parameters
value: The contract.
Returns
The canonical JSON.
EncodeValue<T>(T) method
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.
DecodedContract<T> record
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.
DecodedContract(T, CanonicalJsonResult) constructor
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.
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
| Type | Kind | Description |
|---|---|---|
ContractValidation | class | The field rules of the durable contracts. |
ContractValidationException | class | Raised when a durable contract field breaks its rule. |
IContractValidatable | interface | A 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
condition: The condition.code: The error code.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
RequireContractVersion(int, string) method
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
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.maximumLength: The longest length.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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
value: The value.pointer: The JSON pointer of the value, for the error.
Exceptions
ContractValidationException: The value is not valid.
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: The error code.jsonPointer: The JSON pointer of the field.
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
ContractValidationException: A field breaks its rule.
