Skip to content

Commit 7875ef7

Browse files
committed
Fixes #190 - OneOfValidator cannot validate object with multiple properties, additional test case
1 parent f335920 commit 7875ef7

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

src/test/resources/tests/oneOf.json

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -68,110 +68,110 @@
6868
{
6969
"description": "oneOf with objects and type pattern",
7070
"schema": {
71-
"oneOf": [
72-
{
73-
"type": "object",
74-
"required": [
75-
"type"
76-
],
77-
"properties": {
78-
"type": {
79-
"enum": [
80-
"TYPE_1"
81-
]
82-
}
83-
}
84-
},
85-
{
86-
"type": "object",
87-
"required": [
88-
"type"
89-
],
90-
"properties": {
91-
"type": {
92-
"enum": [
93-
"TYPE_2"
94-
]
95-
}
96-
}
97-
}
98-
99-
]
100-
},
71+
"oneOf": [
72+
{
73+
"type": "object",
74+
"properties": {
75+
"color": {
76+
"type": "string"
77+
},
78+
"id": {
79+
"type": "string"
80+
}
81+
}
82+
},
83+
{
84+
"type": "object",
85+
"required": [
86+
"type"
87+
],
88+
"properties": {
89+
"type": {
90+
"enum": [
91+
"TYPE_2"
92+
]
93+
}
94+
}
95+
}
96+
97+
]
98+
},
10199
"tests": [
102100
{
103101
"description": "first oneOf valid",
104102
"data": {
105-
"type": "TYPE_1"
106-
},
103+
"color": "black",
104+
"id": "abc"
105+
},
107106
"valid": true
108107
},
109108
{
110109
"description": "second oneOf valid",
111110
"data": {
112-
"type": "TYPE_2"
113-
},
111+
"type": "TYPE_2"
112+
},
114113
"valid": true
115114
},
116115
{
117116
"description": "neither oneOf valid",
118117
"data": {
119-
"type": "INVALID_TYPE"
120-
},
118+
"type": "INVALID_TYPE"
119+
},
121120
"valid": false
122121
}
123122
]
124123
},
125124
{
126125
"description": "oneOf with objects and regex pattern",
127126
"schema": {
128-
"oneOf": [
129-
{
130-
"type": "object",
131-
"required": [
132-
"type"
133-
],
134-
"properties": {
135-
"type": {
136-
"type": "string",
137-
"pattern": "^TYPE_1$"
138-
}
139-
}
140-
},
141-
{
142-
"type": "object",
143-
"required": [
144-
"type"
145-
],
146-
"properties": {
147-
"type": {
148-
"type": "string",
149-
"pattern": "^TYPE_2$"
150-
}
151-
}
152-
}
153-
]
154-
},
127+
"oneOf": [
128+
{
129+
"type": "object",
130+
131+
"required": [
132+
"type"
133+
],
134+
"properties": {
135+
"type": {
136+
"type": "string",
137+
"pattern": "^TYPE_1$"
138+
}
139+
}
140+
},
141+
{
142+
"type": "object",
143+
"required": [
144+
"type"
145+
],
146+
"properties": {
147+
"type": {
148+
"type": "string",
149+
"pattern": "^TYPE_2$"
150+
}
151+
}
152+
}
153+
]
154+
},
155155
"tests": [
156156
{
157157
"description": "first oneOf valid",
158158
"data": {
159-
"type": "TYPE_1"
160-
},
159+
"type": "TYPE_1"
160+
},
161161
"valid": true
162162
},
163163
{
164164
"description": "second oneOf valid",
165165
"data": {
166-
"type": "TYPE_2"
167-
},
166+
"type": "TYPE_2"
167+
},
168168
"valid": true
169169
},
170170
{
171171
"description": "neither oneOf valid",
172172
"data": {
173-
"type": "INVALID_TYPE"
174-
},
173+
"type": "INVALID_TYPE"
174+
},
175175
"valid": false
176176
}
177177
]

0 commit comments

Comments
 (0)