Skip to content

Commit 846c169

Browse files
authored
Add additional oneOf tests (#924)
1 parent 79d7417 commit 846c169

File tree

3 files changed

+723
-0
lines changed

3 files changed

+723
-0
lines changed

demo/examples/tests/oneOf.yaml

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
openapi: 3.0.1
2+
info:
3+
title: OneOf Variations API
4+
description: Demonstrates various oneOf schema combinations.
5+
version: 1.0.0
6+
tags:
7+
- name: oneOf
8+
description: oneOf tests
9+
paths:
10+
/oneof-primitive-types:
11+
get:
12+
tags:
13+
- oneOf
14+
summary: oneOf with Primitive Types
15+
description: |
16+
Schema:
17+
```yaml
18+
type: object
19+
properties:
20+
oneOfProperty:
21+
oneOf:
22+
- type: string
23+
- type: number
24+
- type: boolean
25+
```
26+
responses:
27+
"200":
28+
description: Successful response
29+
content:
30+
application/json:
31+
schema:
32+
type: object
33+
properties:
34+
oneOfProperty:
35+
oneOf:
36+
- type: string
37+
- type: number
38+
- type: boolean
39+
40+
/oneof-complex-types:
41+
get:
42+
tags:
43+
- oneOf
44+
summary: oneOf with Complex Types
45+
description: |
46+
Schema:
47+
```yaml
48+
type: object
49+
properties:
50+
oneOfProperty:
51+
oneOf:
52+
- type: object
53+
properties:
54+
objectProp:
55+
type: string
56+
- type: array
57+
items:
58+
type: number
59+
```
60+
responses:
61+
"200":
62+
description: Successful response
63+
content:
64+
application/json:
65+
schema:
66+
type: object
67+
properties:
68+
oneOfProperty:
69+
oneOf:
70+
- type: object
71+
properties:
72+
objectProp:
73+
type: string
74+
- type: array
75+
items:
76+
type: number
77+
78+
/oneof-nested:
79+
get:
80+
tags:
81+
- oneOf
82+
summary: oneOf with Nested oneOf
83+
description: |
84+
Schema:
85+
```yaml
86+
type: object
87+
properties:
88+
oneOfProperty:
89+
oneOf:
90+
- type: object
91+
properties:
92+
nestedOneOfProp:
93+
oneOf:
94+
- type: string
95+
- type: number
96+
- type: boolean
97+
```
98+
responses:
99+
"200":
100+
description: Successful response
101+
content:
102+
application/json:
103+
schema:
104+
type: object
105+
properties:
106+
oneOfProperty:
107+
oneOf:
108+
- type: object
109+
properties:
110+
nestedOneOfProp:
111+
oneOf:
112+
- type: string
113+
- type: number
114+
- type: boolean
115+
116+
# /oneof-discriminator:
117+
# get:
118+
# tags:
119+
# - oneOf
120+
# summary: oneOf with Discriminator
121+
# description: |
122+
# Schema:
123+
# ```yaml
124+
# type: object
125+
# discriminator:
126+
# propertyName: type
127+
# properties:
128+
# type:
129+
# type: string
130+
# oneOf:
131+
# - type: object
132+
# properties:
133+
# type:
134+
# type: string
135+
# enum: ["typeA"]
136+
# propA:
137+
# type: string
138+
# required: ["type"]
139+
# - type: object
140+
# properties:
141+
# type:
142+
# type: string
143+
# enum: ["typeB"]
144+
# propB:
145+
# type: number
146+
# required: ["type"]
147+
# ```
148+
# responses:
149+
# '200':
150+
# description: Successful response
151+
# content:
152+
# application/json:
153+
# schema:
154+
# type: object
155+
# discriminator:
156+
# propertyName: type
157+
# properties:
158+
# type:
159+
# type: string
160+
# oneOf:
161+
# - type: object
162+
# properties:
163+
# type:
164+
# type: string
165+
# enum: ["typeA"]
166+
# propA:
167+
# type: string
168+
# required: ["type"]
169+
# - type: object
170+
# properties:
171+
# type:
172+
# type: string
173+
# enum: ["typeB"]
174+
# propB:
175+
# type: number
176+
# required: ["type"]
177+
178+
/oneof-shared-properties:
179+
get:
180+
tags:
181+
- oneOf
182+
summary: oneOf with Shared Properties
183+
description: |
184+
Schema:
185+
```yaml
186+
type: object
187+
properties:
188+
sharedProp:
189+
type: string
190+
oneOfProperty:
191+
oneOf:
192+
- type: object
193+
properties:
194+
specificPropA:
195+
type: string
196+
- type: object
197+
properties:
198+
specificPropB:
199+
type: number
200+
```
201+
responses:
202+
"200":
203+
description: Successful response
204+
content:
205+
application/json:
206+
schema:
207+
type: object
208+
properties:
209+
sharedProp:
210+
type: string
211+
oneOfProperty:
212+
oneOf:
213+
- type: object
214+
properties:
215+
specificPropA:
216+
type: string
217+
- type: object
218+
properties:
219+
specificPropB:
220+
type: number
221+
222+
/oneof-required-properties:
223+
get:
224+
tags:
225+
- oneOf
226+
summary: oneOf with Required Properties
227+
description: |
228+
Schema:
229+
```yaml
230+
type: object
231+
properties:
232+
oneOfProperty:
233+
oneOf:
234+
- type: object
235+
properties:
236+
requiredPropA:
237+
type: string
238+
required: ["requiredPropA"]
239+
- type: object
240+
properties:
241+
requiredPropB:
242+
type: number
243+
required: ["requiredPropB"]
244+
```
245+
responses:
246+
"200":
247+
description: Successful response
248+
content:
249+
application/json:
250+
schema:
251+
type: object
252+
properties:
253+
oneOfProperty:
254+
oneOf:
255+
- type: object
256+
properties:
257+
requiredPropA:
258+
type: string
259+
required: ["requiredPropA"]
260+
- type: object
261+
properties:
262+
requiredPropB:
263+
type: number
264+
required: ["requiredPropB"]

0 commit comments

Comments
 (0)