Page Contents

Home > @loopback/rest > validateValueAgainstSchema

validateValueAgainstSchema() function

Validate the value against JSON schema.

Signature:

export declare function validateValueAgainstSchema(value: any, schema: SchemaObject | ReferenceObject, globalSchemas?: SchemasObject, options?: ValueValidationOptions): Promise<any>;

Parameters

Parameter Type Description
value any The data value.
schema SchemaObject | ReferenceObject The JSON schema used to perform the validation.
globalSchemas SchemasObject (Optional) Schema references.
options ValueValidationOptions (Optional) Value validation options.

Returns:

Promise<any>