File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,29 @@ export function validate(schemaNameOrObject: Object|string,
4949 }
5050}
5151
52+ /**
53+ * Validates given object and reject on error.
54+ */
55+ export function validateOrReject ( object : Object , validatorOptions ?: ValidatorOptions ) : Promise < void > ;
56+
57+ /**
58+ * Validates given object by a given validation schema and reject on error.
59+ */
60+ export function validateOrReject ( schemaName : string , object : Object , validatorOptions ?: ValidatorOptions ) : Promise < void > ;
61+
62+ /**
63+ * Validates given object by object's decorators or given validation schema and reject on error.
64+ */
65+ export function validateOrReject ( schemaNameOrObject : Object | string ,
66+ objectOrValidationOptions ?: Object | ValidatorOptions ,
67+ maybeValidatorOptions ?: ValidatorOptions ) : Promise < void > {
68+ if ( typeof schemaNameOrObject === "string" ) {
69+ return getFromContainer ( Validator ) . validateOrReject ( schemaNameOrObject as string , objectOrValidationOptions as Object , maybeValidatorOptions ) ;
70+ } else {
71+ return getFromContainer ( Validator ) . validateOrReject ( schemaNameOrObject as Object , objectOrValidationOptions as ValidatorOptions ) ;
72+ }
73+ }
74+
5275/**
5376 * Performs sync validation of the given object.
5477 * Note that this method completely ignores async validations.
You can’t perform that action at this time.
0 commit comments