Skip to content

Commit 78e9a39

Browse files
authored
support for min/maxProperties (#169)
Fixes #168
1 parent 76d8a0f commit 78e9a39

File tree

6 files changed

+709
-440
lines changed

6 files changed

+709
-440
lines changed

docs/json_schema.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ but [see below](#departures-from-json-schema-semantics) for some known differenc
88
There are various limits on the size of the input schema and the resulting grammar.
99
However, we've successfully processed schemas up to 4 MB in size.
1010

11+
For features that are not fully supported, we provide percentages of support among
12+
the 11k [maskbench](https://github.com/guidance-ai/jsonschemabench/tree/main/maskbench) schemas.
13+
1114
## Supported JSON schema features
1215

1316
Following JSON schema features are supported.
1417

1518
Core features:
1619

1720
- `anyOf`
18-
- `oneOf` - converted to `anyOf` only when provably equivalent
19-
- `allOf` - intersection of certain schemas is not supported right now
21+
- `oneOf` (68%) - converted to `anyOf` only when provably equivalent
22+
- `allOf` (98%) - intersection of certain schemas is not supported right now
2023
- `$ref` - external/remote refs unsupported
2124
- `const`
2225
- `enum`
@@ -34,15 +37,20 @@ Object features:
3437

3538
- `properties` - order of properties is fixed to the order in schema
3639
- `additionalProperties`
37-
- `patternProperties` - they have to be disjoint
40+
- `patternProperties` (98%) - they have to be disjoint
3841
- `required`
42+
- `minProperties` and `maxProperties` (90%) - only supported when everything defined in `properties`
43+
is `required` (i.e., it only limits `additionalProperties` or `patternProperties`) - this covers
44+
case of an object used as a map with upper/lower bounds on the number of keys;
45+
there is also some special handling for either/both being `0` or `1` -
46+
mostly for the case of at-least-one-property-required
3947

4048
String features:
4149

4250
- `minLength`
4351
- `maxLength`
44-
- `pattern`
45-
- `format`, with the following formats: `date-time`, `time`, `date`, `duration`, `email`, `hostname`, `ipv4`, `ipv6`, `uuid`,
52+
- `pattern` (99%) - lookarounds not supported
53+
- `format` (74%), with the following formats: `date-time`, `time`, `date`, `duration`, `email`, `hostname`, `ipv4`, `ipv6`, `uuid`,
4654

4755
Number features (for both integer and number):
4856

0 commit comments

Comments
 (0)