File tree Expand file tree Collapse file tree 1 file changed +69
-69
lines changed Expand file tree Collapse file tree 1 file changed +69
-69
lines changed Original file line number Diff line number Diff line change 68
68
{
69
69
"description" : " oneOf with objects and type pattern" ,
70
70
"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
+ },
101
99
"tests" : [
102
100
{
103
101
"description" : " first oneOf valid" ,
104
102
"data" : {
105
- "type" : " TYPE_1"
106
- },
103
+ "color" : " black" ,
104
+ "id" : " abc"
105
+ },
107
106
"valid" : true
108
107
},
109
108
{
110
109
"description" : " second oneOf valid" ,
111
110
"data" : {
112
- "type" : " TYPE_2"
113
- },
111
+ "type" : " TYPE_2"
112
+ },
114
113
"valid" : true
115
114
},
116
115
{
117
116
"description" : " neither oneOf valid" ,
118
117
"data" : {
119
- "type" : " INVALID_TYPE"
120
- },
118
+ "type" : " INVALID_TYPE"
119
+ },
121
120
"valid" : false
122
121
}
123
122
]
124
123
},
125
124
{
126
125
"description" : " oneOf with objects and regex pattern" ,
127
126
"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
+ },
155
155
"tests" : [
156
156
{
157
157
"description" : " first oneOf valid" ,
158
158
"data" : {
159
- "type" : " TYPE_1"
160
- },
159
+ "type" : " TYPE_1"
160
+ },
161
161
"valid" : true
162
162
},
163
163
{
164
164
"description" : " second oneOf valid" ,
165
165
"data" : {
166
- "type" : " TYPE_2"
167
- },
166
+ "type" : " TYPE_2"
167
+ },
168
168
"valid" : true
169
169
},
170
170
{
171
171
"description" : " neither oneOf valid" ,
172
172
"data" : {
173
- "type" : " INVALID_TYPE"
174
- },
173
+ "type" : " INVALID_TYPE"
174
+ },
175
175
"valid" : false
176
176
}
177
177
]
You can’t perform that action at this time.
0 commit comments