Skip to content

Commit

Permalink
Doc: update the documentation of addKeyword args (ajv-validator#2090)
Browse files Browse the repository at this point in the history
* update the documentation of addKeyword args

* add the

* corrections

Co-authored-by: Evgeny Poberezkin <[email protected]>
  • Loading branch information
TommyDew42 and epoberezkin authored Nov 13, 2022
1 parent d6d8d5f commit 7516a09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Formats can be also added via `formats` option.

<a name="api-addkeyword"></a>

### ajv.addKeyword(definition: object): Ajv
### ajv.addKeyword(definition: string | object): Ajv

Add validation keyword to Ajv instance.

Expand Down Expand Up @@ -297,6 +297,8 @@ interface KeywordDefinition {
}
```

If only the property `keyword` is provided in the definition object, you can also pass the keyword name as the argument.

`compile`, `macro` and `code` are mutually exclusive, only one should be used at a time. `validate` can be used separately or in addition to `compile` or `macro` to support [\$data reference](./guide/combining-schemas.md#data-reference).

::: tip Keyword is validated only for applicable data types
Expand Down

0 comments on commit 7516a09

Please sign in to comment.