Skip to content

Commit 8b80e97

Browse files
authored
feat: better support of anyOf/oneOf + type scenario (#88)
1 parent be6df86 commit 8b80e97

File tree

11 files changed

+1168
-183
lines changed

11 files changed

+1168
-183
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"title": "BugExample",
3+
"description": "An example model to demonstrate a bug.",
4+
"allOf": [
5+
{
6+
"properties": {
7+
"actionType": {
8+
"type": "string",
9+
"enum": [
10+
"Cancel",
11+
"Confirm",
12+
"Create",
13+
"Update"
14+
]
15+
},
16+
"id": {
17+
"type": "string",
18+
"description": "The identifier of the existing reservation."
19+
},
20+
"externalId": {
21+
"type": "string"
22+
},
23+
"calculateCosts": {
24+
"type": "boolean"
25+
},
26+
"calculateDates": {
27+
"type": "boolean"
28+
},
29+
"items": {
30+
"type": "array",
31+
"items": {
32+
"type": "string"
33+
}
34+
}
35+
},
36+
"required": [
37+
"actionType",
38+
"items"
39+
]
40+
},
41+
{
42+
"oneOf": [
43+
{
44+
"type": "object",
45+
"properties": {
46+
"actionType": {
47+
"type": "string",
48+
"enum": [
49+
"Cancel",
50+
"Confirm",
51+
"Update"
52+
]
53+
},
54+
"id": {
55+
"type": "string"
56+
}
57+
},
58+
"required": [
59+
"actionType",
60+
"id"
61+
]
62+
},
63+
{
64+
"type": "object",
65+
"properties": {
66+
"actionType": {
67+
"type": "string",
68+
"enum": [
69+
"Create"
70+
]
71+
}
72+
},
73+
"required": [
74+
"actionType"
75+
]
76+
}
77+
]
78+
}
79+
],
80+
"type": "object"
81+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"oneOf": [
3+
{
4+
"items": {
5+
"properties": {
6+
"foo": {
7+
"type": "string",
8+
"enum": ["test"]
9+
}
10+
}
11+
}
12+
},
13+
{
14+
"items": {
15+
"properties": {
16+
"foo": {
17+
"type": "number"
18+
},
19+
"bar": {
20+
"type": "string"
21+
}
22+
}
23+
}
24+
}
25+
],
26+
"type": "array",
27+
"items": {
28+
"type": "object",
29+
"properties": {
30+
"foo": {
31+
"type": ["string", "number"]
32+
},
33+
"baz": {
34+
"type": "integer"
35+
}
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)