[BUG] Fix for Swagger UI generation
[cps.git] / cps-rest / docs / openapi / components.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021-2022 Bell Canada.
3 # Modifications Copyright (C) 2021-2023 Nordix Foundation
4 # Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
5 # Modifications Copyright (C) 2022 Deutsche Telekom AG
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
21
22 components:
23   schemas:
24
25     AnchorDetails:
26       type: object
27       title: Anchor details by anchor Name
28       properties:
29         name:
30           type: string
31           example: my-anchor
32         dataspaceName:
33           type: string
34           example: my-dataspace
35         schemaSetName:
36           type: string
37           example: my-schema-set
38
39     DataspaceDetails:
40       type: object
41       title: Dataspace details by dataspace Name
42       properties:
43         name:
44           type: string
45           example: my-dataspace
46
47     ErrorMessage:
48       type: object
49       title: Error
50       properties:
51         status:
52           type: string
53         message:
54           type: string
55         details:
56           type: string
57
58     MultipartFile:
59       type: object
60       required:
61         - file
62       properties:
63         file:
64           type: string
65           description: multipartFile
66           format: binary
67
68     ModuleReferences:
69       type: object
70       title: Module reference object
71       properties:
72         name:
73           type: string
74           example: my-module-reference-name
75         namespace:
76           type: string
77           example: my-module-reference-namespace
78         revision:
79           type: string
80           example: my-module-reference-revision
81
82     SchemaSetDetails:
83       type: object
84       title: Schema set details by dataspace and schemasetName
85       required:
86         - "moduleReferences"
87       properties:
88         dataspaceName:
89           type: string
90           example: my-dataspace
91         moduleReferences:
92           type: array
93           items:
94             $ref: '#/components/schemas/ModuleReferences'
95         name:
96           type: string
97           example: my-schema-set
98
99   examples:
100     dataSample:
101       value:
102         test:bookstore:
103           bookstore-name: Chapters
104           categories:
105             - code: 01
106               name: SciFi
107             - code: 02
108               name: kids
109     dataSampleXml:
110         value:
111           <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
112             <bookstore xmlns="org:onap:ccsdk:sample">
113               <bookstore-name>Chapters</bookstore-name>
114               <categories>
115                 <code>1</code>
116                 <name>SciFi</name>
117               </categories>
118             </bookstore>
119           </stores>
120     dataSampleAcrossAnchors:
121       value:
122         - anchorName: bookstore1
123           dataNode:
124             test:bookstore:
125               bookstore-name: Chapters
126               categories:
127                 - code: 01
128                   name: SciFi
129                 - code: 02
130                   name: kids
131         - anchorName: bookstore2
132           dataNode:
133             test:bookstore:
134               bookstore-name: Chapters
135               categories:
136                 - code: 01
137                   name: SciFi
138                 - code: 02
139                   name: kids
140
141   parameters:
142     dataspaceNameInQuery:
143       name: dataspace-name
144       in: query
145       description: dataspace-name
146       required: true
147       schema:
148         type: string
149         example: my-dataspace
150     dataspaceNameInPath:
151       name: dataspace-name
152       in: path
153       description: dataspace-name
154       required: true
155       schema:
156         type: string
157         example: my-dataspace
158     anchorNameInPath:
159       name: anchor-name
160       in: path
161       description: anchor-name
162       required: true
163       schema:
164         type: string
165         example: my-anchor
166     schemaSetNameInQuery:
167       name: schema-set-name
168       in: query
169       description: schema-set-name
170       required: true
171       schema:
172         type: string
173         example: my-schema-set
174     schemaSetNameInPath:
175       name: schema-set-name
176       in: path
177       description: schema-set-name
178       required: true
179       schema:
180         type: string
181         example: my-schema-set
182     anchorNameInQuery:
183       name: anchor-name
184       in: query
185       description: anchor-name
186       required: true
187       schema:
188         type: string
189         example: my-anchor
190     xpathInQuery:
191       name: xpath
192       in: query
193       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html
194       required: false
195       schema:
196         type: string
197         default: /
198       examples:
199         container xpath:
200           value: /shops/bookstore
201         list attributes xpath:
202           value: /shops/bookstore/categories[@code=1]
203     requiredXpathInQuery:
204       name: xpath
205       in: query
206       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html
207       required: true
208       schema:
209         type: string
210       examples:
211         container xpath:
212           value: /shops/bookstore
213         list attributes xpath:
214           value: /shops/bookstore/categories[@code=1]
215     cpsPathInQuery:
216       name: cps-path
217       in: query
218       description: For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html
219       required: false
220       schema:
221         type: string
222         default: /
223       examples:
224         container cps path:
225           value: //bookstore
226         list attributes cps path:
227           value: //categories[@code=1]
228     includeDescendantsOptionInQuery:
229       name: include-descendants
230       in: query
231       description: include-descendants
232       required: false
233       schema:
234         type: boolean
235         default: false
236         example: false
237     observedTimestampInQuery:
238       name: observed-timestamp
239       in: query
240       description: observed-timestamp
241       required: false
242       schema:
243         type: string
244         example: '2021-03-21T00:10:34.030-0100'
245     apiVersionInPath:
246       name: apiVersion
247       in: path
248       description: apiVersion
249       required: true
250       schema:
251         type: string
252         enum: [v1, v2]
253         default: v2
254     contentTypeHeader:
255       name: Content-Type
256       in: header
257       description: Content type header
258       schema:
259         type: string
260         example: 'application/json'
261       required: true
262     descendantsInQuery:
263       name: descendants
264       in: query
265       description: Number of descendants to query. Allowed values are 'none', 'all', 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive number.
266       required: false
267       schema:
268         type: string
269         default: none
270         example: 3
271     pageIndexInQuery:
272       name: pageIndex
273       in: query
274       description: page index for pagination over anchors. It must be greater then zero if provided.
275       required: false
276       schema:
277         type: integer
278         example: 1
279     pageSizeInQuery:
280       name: pageSize
281       in: query
282       description: number of records (anchors) per page. It must be greater then zero if provided.
283       required: false
284       schema:
285         type: integer
286         example: 10
287
288   responses:
289     NotFound:
290       description: The specified resource was not found
291       content:
292         application/json:
293           schema:
294             $ref: '#/components/schemas/ErrorMessage'
295           example:
296             status: 404
297             message: Resource Not Found
298             details: The requested resource is not found
299     Unauthorized:
300       description: Unauthorized
301       content:
302         application/json:
303           schema:
304             $ref: '#/components/schemas/ErrorMessage'
305           example:
306             status: 401
307             message: Unauthorized request
308             details: This request is unauthorized
309     Forbidden:
310       description: Forbidden
311       content:
312         application/json:
313           schema:
314             $ref: '#/components/schemas/ErrorMessage'
315           example:
316             status: 403
317             message: Request Forbidden
318             details: This request is forbidden
319     BadRequest:
320       description: Bad Request
321       content:
322         application/json:
323           schema:
324             $ref: '#/components/schemas/ErrorMessage'
325           example:
326             status: 400
327             message: Bad Request
328             details: The provided request is not valid
329     Conflict:
330       description: Conflict
331       content:
332         application/json:
333           schema:
334             $ref: '#/components/schemas/ErrorMessage'
335           example:
336             status: 409
337             message: Conflicting request
338             details: The request cannot be processed as the resource is in use.
339     Ok:
340       description: OK
341       content:
342         application/json:
343           schema:
344             type: object
345           examples:
346             dataSample:
347               value: ""
348     Created:
349       description: Created
350       content:
351         text/plain:
352           schema:
353             type: string
354             example: my-resource
355     CreatedV2:
356       description: Created without response body
357     InternalServerError:
358       description: Internal Server Error
359       content:
360         application/json:
361           schema:
362             $ref: "#/components/schemas/ErrorMessage"
363           example:
364             status: 500
365             message: Internal Server Error
366             details: Internal Server Error occurred
367     NoContent:
368       description: No Content
369       content: {}