...
1swagger: '2.0'
2info:
3 title: additionalItems
4 version: '1.0'
5 description: 'this spec exercise the additionalItems property on params and responses, with default and example values. This one is valid.'
6 license:
7 name: MIT
8host: localhost:8081
9basePath: /api/v1
10schemes:
11 - http
12consumes:
13 - application/json
14produces:
15 - application/json
16paths:
17 /servers/getBad1:
18 get:
19 operationId: getGoodOp
20 parameters:
21 - name: addItems
22 in: body
23 schema:
24 type: array
25 # Unsupported keyword
26 #additionalItems: false
27 items:
28 # inline schema
29 - type: object
30 properties:
31 first:
32 type: string
33 # ref simple schema
34 - $ref: '#/definitions/itemsSchema0'
35 # ref multiple complex schemas
36 - $ref: '#/definitions/itemsSchema1'
37 - $ref: '#/definitions/itemsSchema2'
38 - $ref: '#/definitions/itemsSchema3'
39 default:
40 - first: [ 'A' , 'B' ] #<-- error
41 - 'Default string' #<-- validates scheme0
42 - x: 1 #<-- error
43 c: 'ABC' #<-- error
44 - z: x #<-- error
45 example:
46 - first: 2 #<-- error
47 - 'A string' #<-- validates scheme0
48 -
49 c: 1
50 #x: 'a' #<-- error
51 - z: true #<-- error
52 responses:
53 default:
54 schema:
55 type: array
56 # Unsupported keyword
57 #additionalItems: false
58 items:
59 # inline schema
60 - type: object
61 properties:
62 first:
63 type: string
64 # ref simple schema
65 - $ref: '#/definitions/itemsSchema0'
66 # ref multiple complex schemas
67 - $ref: '#/definitions/itemsSchema1'
68 - $ref: '#/definitions/itemsSchema2'
69 - $ref: '#/definitions/itemsSchema3'
70 default:
71 - first: [ 'A' , 'B' ] #<-- error
72 - 'Default string' #<-- validates scheme0
73 - x: 1 #<-- error
74 c: 'ABC' #<-- error
75 - z: x #<-- error
76 example:
77 - first: 2 #<-- error
78 - 'A string' #<-- validates scheme0
79 -
80 c: 1
81 #x: 'a' #<-- error
82 - z: true #<-- error
83 examples:
84 application/json:
85 - first: 2 #<-- error
86 - 'A string' #<-- validates scheme0
87 -
88 c: 1
89 #x: 'a' #<-- error
90 - z: true #<-- error
91
92 200:
93 description: 'ok'
94 schema:
95 type: array
96 # Unsupported keyword
97 #additionalItems: false
98 items:
99 # inline schema
100 - type: object
101 properties:
102 first:
103 type: string
104 # ref simple schema
105 - $ref: '#/definitions/itemsSchema0'
106 # ref multiple complex schemas
107 - $ref: '#/definitions/itemsSchema1'
108 - $ref: '#/definitions/itemsSchema2'
109 - $ref: '#/definitions/itemsSchema3'
110 default:
111 - first: [ 'A' , 'B' ] #<-- error
112 - 'Default string' #<-- validates scheme0
113 - x: 1 #<-- error
114 c: 'ABC' #<-- error
115 - z: x #<-- error
116 example:
117 - first: 2 #<-- error
118 - 'A string' #<-- validates scheme0
119 -
120 c: 1
121 #x: 'a' #<-- error
122 - z: true #<-- error
123 examples:
124 application/json:
125 - first: 2 #<-- error
126 - 'A string' #<-- validates scheme0
127 -
128 c: 1
129 #x: 'a' #<-- error
130 - z: true #<-- error
131 /servers/getBad2:
132 get:
133 operationId: getGoodOp2
134 parameters:
135 - name: addItems
136 in: body
137 schema:
138 type: array
139 # Unsupported keyword
140 #additionalItems: false
141 items:
142 # inline schema
143 - type: object
144 properties:
145 first:
146 type: string
147 # ref simple schema
148 - $ref: '#/definitions/itemsSchema0'
149 # ref multiple complex schemas
150 - $ref: '#/definitions/itemsSchema1'
151 - $ref: '#/definitions/itemsSchema2'
152 - $ref: '#/definitions/itemsSchema3'
153 default:
154 - first: 'Default string' #<-- validates inline schema
155 - 'Default string' #<-- validates scheme0
156 - x: 'a' #<-- validates schema1
157 c: 1
158 - z: 1 #<-- validate schema2
159 example:
160 - first: 'Default string' #<-- validates inline schema
161 - 'A string' #<-- validates scheme0
162 - x: 'a' #<-- validates schema1
163 c: 1
164 - z: 1
165 responses:
166 200:
167 description: 'ok'
168 /servers/getBad3:
169 get:
170 operationId: getGoodOp3
171 parameters:
172 - name: addItems
173 in: body
174 schema:
175 type: array
176 # Unsupported keyword
177 #additionalItems: false
178 items:
179 # inline schema
180 - type: object
181 properties:
182 first:
183 type: string
184 # ref simple schema
185 - $ref: '#/definitions/itemsSchema0'
186 # ref multiple complex schemas
187 - $ref: '#/definitions/itemsSchema1'
188 - $ref: '#/definitions/itemsSchema2'
189 - $ref: '#/definitions/itemsSchema3'
190 default:
191 - first: 'Default string' #<-- validates inline schema
192 - 'Default string' #<-- validates scheme0
193 - x: 'a' #<-- validates schema1
194 c: 1
195 - z: 1 #<-- validate schema2
196 example:
197 - first: 'Default string' #<-- validates inline schema
198 - 'A string' #<-- validates scheme0
199 - x: 'a' #<-- validates schema1
200 c: 1
201 - z: 1
202 responses:
203 200:
204 description: 'ok'
205definitions:
206 itemsSchema0:
207 type: string
208 itemsSchema1:
209 type: object
210 required:
211 - x
212 - c
213 properties:
214 x:
215 type: string
216 enum:
217 - 'a'
218 - 'b'
219 - 'c'
220 default: 'a'
221 example: 'b'
222 c:
223 type: number
224 default: 1
225 example: 9
226 example:
227 x: 'c'
228 c: 12
229 itemsSchema2:
230 type: object
231 required:
232 - z
233 properties:
234 z:
235 type: number
236 default: 1
237 example: 9
238 example:
239 z: 12
240 itemsSchema3:
241 type: array
242 items:
243 type: array
244 items:
245 type: object
246 properties:
247 a:
248 type: string
249 default: 'a'
250 example: 'A'
251 b:
252 type: string
253 default: 'b'
254 example: 'B'
255 required: [ a, b ]
256 default:
257 a: 'x'
258 b: 'y'
259 example:
260 a: 'u'
261 b: 'v'
262 default:
263 - a: 'u'
264 #b: 'v' #<-- error
265 example:
266 - a: 'u'
267 b: 'v'
268 default:
269 -
270 - a: 'a'
271 - b: 'b'
272 -
273 - a: 'c'
274 - b: 'd'
275 example:
276 -
277 #- a: 'a' #<-- error
278 - b: 'b'
279 -
280 - a: 'c'
281 - b: 'd'
View as plain text