Skip to content

Commit

Permalink
Fix doc formatting for prefixItems (#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyok authored Jul 15, 2021
1 parent 18de168 commit ceac236
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/json-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,16 @@ For the data array to be valid, the items with indices less than the number of s

_schema_:

```javascript
{
type: "array",
prefixItems: [{type: "integer"}, {type: "string"}]
}
```
```javascript
{
type: "array",
prefixItems: [{type: "integer"}, {type: "string"}]
}
```

_valid_: `[1]`, `[1, "abc"]`, `[1, "abc", 2]`, `[]`
_valid_: `[1]`, `[1, "abc"]`, `[1, "abc", 2]`, `[]`

_invalid_: `["abc", 1]`, `["abc"]`
_invalid_: `["abc", 1]`, `["abc"]`

The schema in example will log warning by default (see `strictTuples` option), because it defines unconstrained tuple. To define a tuple with exactly 2 elements use [minItems](#minitems) and [items](#items-in-draft-2020-12) keywords (see example 2 in [items](#items-in-draft-2020-12)).

Expand Down

0 comments on commit ceac236

Please sign in to comment.