...
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/getGood:
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: 'Default string' #<-- validates inline schema
41 - 'Default string' #<-- validates scheme0
42 - x: 'a' #<-- validates schema1
43 c: 1
44 - z: 1 #<-- validate schema2
45 example:
46 - first: 'Default string' #<-- validates inline schema
47 - 'A string' #<-- validates scheme0
48 - x: 'a' #<-- validates schema1
49 c: 1
50 - z: 1
51 responses:
52 default:
53 description: 'default'
54 schema:
55 type: string
56 examples: #<-- warning
57 application/xml:
58 a: ""
59 200:
60 description: 'ok'
61 examples: #<-- warning examples without schema
62 application/json:
63 - 'A'
64 - 'B'
65definitions:
66 itemsSchema0:
67 type: string
68 itemsSchema1:
69 type: object
70 required:
71 - x
72 - c
73 properties:
74 x:
75 type: string
76 enum:
77 - 'a'
78 - 'b'
79 - 'c'
80 default: 'a'
81 example: 'b'
82 c:
83 type: number
84 default: 1
85 example: 9
86 example:
87 x: 'c'
88 c: 12
89 itemsSchema2:
90 type: object
91 required:
92 - z
93 properties:
94 z:
95 type: number
96 default: 1
97 example: 9
98 example:
99 z: 12
100 itemsSchema3:
101 type: array
102 items:
103 type: array
104 items:
105 type: object
106 properties:
107 a:
108 type: string
109 default: 'a'
110 example: 'A'
111 b:
112 type: string
113 default: 'b'
114 example: 'B'
115 required: [ a, b ]
116 default:
117 a: 'x'
118 b: 'y'
119 example:
120 a: 'u'
121 b: 'v'
122 default:
123 - a: 'u'
124 b: 'v'
125 example:
126 - a: 'u'
127 b: 'v'
128 default:
129 -
130 - a: 'a'
131 - b: 'b'
132 -
133 - a: 'c'
134 - b: 'd'
135 example:
136 -
137 - a: 'a'
138 - b: 'b'
139 -
140 - a: 'c'
141 - b: 'd'
View as plain text