Skip to content

Commit 4307fda

Browse files
tomakehurstclaude
andcommitted
Add regression test confirming nullable allOf+$ref fix is dialect-scoped
Confirms, per maintainer feedback on the upstream issue, that the dynamic evaluation stack walk added for nullable allOf + $ref compositions has no effect outside dialects that enable the nullable keyword (currently only OpenAPI 3.0.x) — null is still rejected for the same schema shape under draft-07. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 124ec42 commit 4307fda

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/test/java/com/networknt/schema/TypeValidatorTest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,37 @@ void nullable() {
185185
assertEquals(1, errors.size());
186186
}
187187

188+
@Test
189+
void nullableAllOfRefIgnoredOutsideNullableDialect() {
190+
String schemaData = """
191+
{
192+
"$schema": "http://json-schema.org/draft-07/schema#",
193+
"type": "object",
194+
"required": ["value"],
195+
"properties": {
196+
"value": {
197+
"allOf": [ { "$ref": "#/definitions/Money" } ],
198+
"nullable": true
199+
}
200+
},
201+
"definitions": {
202+
"Money": {
203+
"type": "object",
204+
"required": ["amount"],
205+
"properties": {
206+
"amount": { "type": "integer" }
207+
}
208+
}
209+
}
210+
}
211+
""";
212+
final SchemaRegistry factory = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_7);
213+
final Schema validator = factory.getSchema(schemaData);
214+
215+
final List<Error> errors = validator.validate("{ \"value\": null }", InputFormat.JSON);
216+
assertEquals(1, errors.size());
217+
}
218+
188219
@Test
189220
void integerNonFinite() {
190221
String schemaData = "{\r\n"

0 commit comments

Comments
 (0)