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](/doc/en/lb4/apidocs.rest.valuevalidationoptions.html) | _(Optional)_ Value validation options. |
Returns:
Promise<any>