Skip to content

Commit eadca77

Browse files
Add missing JSON Schema keywords to SCHEMA_KEYWORDS
Add missing keywords for completeness: $comment, definitions, $defs, contains, if/then/else, readOnly, writeOnly. Note that enum and const are intentionally excluded as they are handled specially by this fix. Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
1 parent 9228e0b commit eadca77

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/JsonSchema/SchemaStorage.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,33 @@ class SchemaStorage implements SchemaStorageInterface
2020
*
2121
* Note: 'properties' is a schema keyword (e.g., {"type": "object", "properties": {...}}).
2222
* The properties *container* (the value) won't have these keywords, so it won't match.
23+
*
24+
* Note: 'enum' and 'const' are intentionally excluded as they are handled specially.
2325
*/
2426
private const SCHEMA_KEYWORDS = [
2527
// Core schema identifiers
26-
'$schema', 'id', '$id', 'title', 'description',
28+
'$schema', 'id', '$id', '$comment', 'title', 'description',
2729

2830
// Type and structure
2931
'type', 'properties', 'patternProperties', 'additionalProperties',
3032
'items', 'additionalItems', 'required', 'dependencies',
33+
'definitions', '$defs',
3134

3235
// Validation keywords
3336
'format', 'pattern',
3437
'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf',
3538
'minLength', 'maxLength',
36-
'minItems', 'maxItems', 'uniqueItems',
39+
'minItems', 'maxItems', 'uniqueItems', 'contains',
3740
'minProperties', 'maxProperties',
3841

3942
// Composition
4043
'allOf', 'anyOf', 'oneOf', 'not',
4144

42-
// Metadata
43-
'default', 'examples'
45+
// Conditionals
46+
'if', 'then', 'else',
47+
48+
// Metadata and annotations
49+
'default', 'examples', 'readOnly', 'writeOnly'
4450
];
4551

4652
protected $uriRetriever;

0 commit comments

Comments
 (0)