[Doc] Make .compile API clearer
parent
a6df5867f1
commit
24e1c7512e
|
@ -846,9 +846,10 @@ Create Ajv instance.
|
||||||
|
|
||||||
Generate validating function and cache the compiled schema for future use.
|
Generate validating function and cache the compiled schema for future use.
|
||||||
|
|
||||||
Validating function returns boolean and has properties `errors` with the errors from the last validation (`null` if there were no errors) and `schema` with the reference to the original schema.
|
Validating function returns a boolean value and has two properties: `errors`, `schema`. Any errors returned from the last validation are set to `errors`
|
||||||
|
while the value of `errors` is set to `null` to indicate no errors. `schema` contains the reference to the original schema.
|
||||||
|
|
||||||
Unless the option `validateSchema` is false, the schema will be validated against meta-schema and if schema is invalid the error will be thrown. See [options](#options).
|
The schema will be validated against meta-schema unless `validateSchema` option is set to false. If schema is invalid, an error will be thrown. See [options](#options).
|
||||||
|
|
||||||
|
|
||||||
##### <a name="api-compileAsync"></a>.compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise
|
##### <a name="api-compileAsync"></a>.compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise
|
||||||
|
@ -899,7 +900,7 @@ This allows you to do nice things like the following.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri);
|
var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri);
|
||||||
```
|
```
|
||||||
|
|
||||||
##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv
|
##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue