...
1---
2swagger: '2.0'
3info:
4 title: bar CRUD API
5 version: 4.2.0
6schemes:
7 - http
8basePath: /api
9consumes:
10 - application/json
11produces:
12 - application/json
13paths:
14 /common:
15 get:
16 operationId: commonGet
17 summary: here to test path collisons
18 responses:
19 '200':
20 description: OK
21 schema:
22 $ref: "#/definitions/bar"
23 /bars:
24 post:
25 operationId: create
26 summary: Create a new bar
27 parameters:
28 - name: info
29 in: body
30 schema:
31 $ref: "#/definitions/bar"
32 responses:
33 '201':
34 description: created
35 schema:
36 $ref: "#/definitions/barId"
37 default:
38 description: error
39 schema:
40 $ref: "#/definitions/error"
41 /bars/{barid}:
42 get:
43 operationId: get
44 summary: Get a bar by id
45 parameters:
46 - $ref: "#/parameters/barid"
47 responses:
48 '200':
49 description: OK
50 schema:
51 $ref: "#/definitions/bar"
52 '401':
53 $ref: "#/responses/401"
54 '404':
55 $ref: "#/responses/404"
56 default:
57 description: error
58 schema:
59 $ref: "#/definitions/error"
60 delete:
61 operationId: delete
62 summary: delete a bar by id
63 parameters:
64 - name: barid
65 in: path
66 required: true
67 type: string
68 responses:
69 '200':
70 description: OK
71 '401':
72 description: unauthorized
73 schema:
74 $ref: "#/definitions/error"
75 '404':
76 description: resource not found
77 schema:
78 $ref: "#/definitions/error"
79 default:
80 description: error
81 schema:
82 $ref: "#/definitions/error"
83 post:
84 operationId: update
85 summary: update a bar by id
86 parameters:
87 - name: barid
88 in: path
89 required: true
90 type: string
91 - name: info
92 in: body
93 schema:
94 $ref: "#/definitions/bar"
95 responses:
96 '200':
97 description: OK
98 '401':
99 description: unauthorized
100 schema:
101 $ref: "#/definitions/error"
102 '404':
103 description: resource not found
104 schema:
105 $ref: "#/definitions/error"
106 default:
107 description: error
108 schema:
109 $ref: "#/definitions/error"
110
111definitions:
112 common:
113 type: object
114 required:
115 - id
116 properties:
117 id:
118 type: string
119 format: string
120 minLength: 1
121 bar:
122 type: object
123 required:
124 - name
125 - description
126 properties:
127 id:
128 type: string
129 format: string
130 readOnly: true
131 name:
132 type: string
133 format: string
134 minLength: 1
135 description:
136 type: string
137 format: string
138 minLength: 1
139 barId:
140 type: object
141 required:
142 - id
143 properties:
144 id:
145 type: string
146 format: string
147 minLength: 1
148 error:
149 type: object
150 required:
151 - message
152 properties:
153 code:
154 type: string
155 format: string
156 message:
157 type: string
158 fields:
159 type: string
160
161parameters:
162 common:
163 name: common
164 in: query
165 type: string
166 barid:
167 name: barid
168 in: path
169 required: true
170 type: string
171
172responses:
173 401:
174 description: bar unauthorized
175 schema:
176 $ref: "#/definitions/error"
177 404:
178 description: bar resource not found
179 schema:
180 $ref: "#/definitions/error"
View as plain text