-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Warning on rejected async validation #3100
Copy link
Copy link
Open
Labels
bugBug or defectBug or defect
Description
Runtime
node.js
Runtime version
18+
Module version
17.13.3
Last module version without issue
No response
Used with
standalone
Any other relevant information
No response
What are you trying to achieve or the steps to reproduce?
Currently synchronous validation returns ValidationResult<TSchema> type, which is following:
type ValidationResult<TSchema = any> = {
error: undefined;
warning?: ValidationError;
value: TSchema;
} | {
error: ValidationError;
warning?: ValidationError;
value: any;
}So both in case of successful validation and error we always have warnings in the result. But when switching to asynchronous validation with warnings turned on validateAsync(value, { warnings: true }) in case of error the promise rejects and we have only ValidationError which doesn't incllude any warnings.
If this is by design, and synchronous and asynchronous validation have that difference, then it's not documented anywhere clearly.
Is there any way to still have the warnings in case of promise rejection for async validation?
What was the result you got?
error on promise rejection
What result did you expect?
error with warnings included
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect