Skip to content

API ReferenceValidationInterface

ValidationIssue

One problem validation found with an operation’s inputs, as a plain data object. The validate* methods, such as LOCModule.validateCreateStatic, return a list of these, and so does an invalid WorkflowExecutionResult. An empty list means the inputs are valid.

Switch on code to handle a case in code, and pass the issue to getValidationErrorMessage for text to show the user. An issue is not an Error, so it can be serialized, stored, and compared with deep equality.

Properties

code

readonly code: ValidationErrorCode;

Which check failed, as a stable ValidationErrorCode constant such as AmountExceedsCollateralBacking or ExpirationTooFar. Switch on it for programmatic handling; pass the whole issue to getValidationErrorMessage for user-facing text.


context?

readonly optional context?: Record<string, unknown>;

Machine-readable detail behind the code, with keys that depend on the check: for example { available, required } for CollateralInsufficient, or { min } and { max } for the credited-amount bounds. A failed read, such as an RPC error, is not an issue: it rejects the validation call instead.


field

readonly field: string;

The input the issue is about, named as in the operation’s parameters, such as creditedTokenAmount or locID. For an item in a list input it can name the item’s field instead: an issue with one redemption’s amount has field 'amount', not 'redemptions'.


message?

readonly optional message?: string;

Readable text with detail specific to this issue, such as a shortfall amount, when there is any. getValidationErrorMessage returns it in place of the standard message for code.