Page Contents

Home > @loopback/rest > validateValueAgainstSchema

validateValueAgainstSchema() function

Validate the request body data against JSON schema.

Signature:

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

Parameters

Parameter Type Description
value any  
schema SchemaObject | ReferenceObject The JSON schema used to perform the validation.
globalSchemas SchemasObject Schema references.
options ValueValidationOptions Request body validation options.

Returns:

Promise<void>