@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
38 lines (25 loc) • 1.24 kB
Markdown
lang: en
title: 'API docs: rest.validatevalueagainstschema'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest
permalink: /doc/en/lb4/apidocs.rest.validatevalueagainstschema.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md) > [validateValueAgainstSchema](./rest.validatevalueagainstschema.md)
## validateValueAgainstSchema() function
Validate the value against JSON schema.
<b>Signature:</b>
```typescript
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 | Schema references. |
| options | [ValueValidationOptions](./rest.valuevalidationoptions.md) | Value validation options. |
<b>Returns:</b>
Promise<any>