Skip to content

Commit 541b039

Browse files
committed
adding one more test, checking common property loading for synthetic allOf schemas
1 parent 93f3c7b commit 541b039

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

core/src/test/java/org/everit/json/schema/loader/SchemaLoaderTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,21 @@ public void unknownMetaSchemaException() {
687687
}
688688

689689
@Test
690-
public void sythetizedAllOf() {
690+
public void syntheticAllOf() {
691691
String actual = SchemaLoader.load(get("boolAndNot")).toString();
692692
assertTrue(ObjectComparator.deepEquals(
693693
get("boolAndNot"),
694694
new JSONObject(actual)
695695
));
696+
}
696697

698+
@Test
699+
public void commonPropsGoIntoWrappingAllOf() {
700+
CombinedSchema actual = (CombinedSchema) SchemaLoader.load(get("syntheticAllOfWithCommonProps"));
701+
assertEquals(CombinedSchema.ALL_CRITERION, actual.getCriterion());
702+
assertEquals("http://id", actual.getId());
703+
assertEquals("my title", actual.getTitle());
704+
assertEquals("my description", actual.getDescription());
705+
assertNull(actual.getSubschemas().iterator().next().getId());
697706
}
698707
}

core/src/test/resources/org/everit/jsonvalidator/testschemas.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,5 +646,16 @@
646646
"boolAndNot": {
647647
"type": "boolean",
648648
"not": false
649+
},
650+
"syntheticAllOfWithCommonProps": {
651+
"type": "integer",
652+
"enum": [
653+
1,
654+
2,
655+
3
656+
],
657+
"id": "http://id",
658+
"title": "my title",
659+
"description": "my description"
649660
}
650661
}

0 commit comments

Comments
 (0)