Skip to content

Commit

Permalink
Merge branch 'master' into add-encoded-ref-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoniangreen authored Jun 30, 2024
2 parents 7494992 + a18641e commit 10c7496
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/guide/managing-schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ In the example above, the key passed to the `addSchema` method was used to retri

### Pre-adding all schemas vs adding on demand

In the example above all schemas were added in advance. It is also possible, to add schemas as they are used - it can be helpful if there is many schemas. In this case, you need to check first whether the schema is already added by calling `getSchema` method - it would return `undefined` if not:
In the example above all schemas were added in advance. It is also possible, to add schemas as they are used - it can be helpful if there are many schemas. In this case, you need to check first whether the schema is already added by calling `getSchema` method - it would return `undefined` if not:

```javascript
const schema_user = require("./schema_user.json")
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/modifying-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ With `useDefaults` option `default` keywords throws exception during schema comp

The strict mode option can change the behaviour for these unsupported defaults (`strict: false` to ignore them, `"log"` to log a warning).

See [Strict mode](./strict-mode.md).
See [Strict mode](../strict-mode.md).

::: tip Default with discriminator keyword
Defaults will be assigned in schemas inside `oneOf` in case [discriminator](../json-schema.md#discriminator) keyword is used.
Expand Down
6 changes: 3 additions & 3 deletions docs/json-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,11 @@ To create and equivalent schema in draft-2020-12 use keywords [prefixItems](#pre

The value of the keyword should be a boolean or an object.

If `items` keyword is not present or it is an object, `additionalItems` keyword should be ignored regardless of its value. By default Ajv will throw exception in this case - see [Strict mode](./strict-mode.md)
`additionalItems` keyword is ignored if `items` keyword is not present or is an object. By default Ajv will throw exception in this case - see [Strict mode](./strict-mode.md)

If `items` keyword is an array and data array has not more items than the length of `items` keyword value, `additionalItems` keyword is also ignored.
`additionalItems` keyword is ignored if `items` keyword has more elements than data array.

If the length of data array is bigger than the length of "items" keyword value than the result of the validation depends on the value of `additionalItems` keyword:
If the data array has more elements than the `items` keyword value then the result of the validation depends on the value of `additionalItems` keyword:

- `false`: data is invalid
- `true`: data is valid
Expand Down
4 changes: 2 additions & 2 deletions docs/strict-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ By default Ajv fails schema compilation when unknown keywords are used. Users ca
ajv.addKeyword("allowedKeyword")
```

or
or use the convenience method `addVocabulary` for multiple keywords

```javascript
ajv.addVocabulary(["allowed1", "allowed2"])
ajv.addVocabulary(["allowed1", "allowed2"]) // simply calls addKeyword multiple times
```

#### Ignored "additionalItems" keyword
Expand Down

0 comments on commit 10c7496

Please sign in to comment.