Support pagination in query across all anchors(ep4)
[cps.git] / cps-rest / docs / openapi / components.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021-2022 Bell Canada.
3 # Modifications Copyright (C) 2021-2022 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           example:  'https://github.com/onap/cps/blob/master/cps-service/src/test/resources/bookstore.yang'
68
69     ModuleReferences:
70       type: object
71       title: Module reference object
72       properties:
73         name:
74           type: string
75           example: my-module-reference-name
76         namespace:
77           type: string
78           example: my-module-reference-namespace
79         revision:
80           type: string
81           example: my-module-reference-revision
82
83     SchemaSetDetails:
84       type: object
85       title: Schema set details by dataspace and schemasetName
86       required:
87         - "moduleReferences"
88       properties:
89         dataspaceName:
90           type: string
91           example: my-dataspace
92         moduleReferences:
93           type: array
94           items:
95             $ref: '#/components/schemas/ModuleReferences'
96         name:
97           type: string
98           example: my-schema-set
99
100   examples:
101     dataSample:
102       value:
103         test:bookstore:
104           bookstore-name: Chapters
105           categories:
106             - code: 01
107               name: SciFi
108             - code: 02
109               name: kids
110     dataSampleXml:
111         value:
112           <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
113             <bookstore xmlns="org:onap:ccsdk:sample">
114               <bookstore-name>Chapters</bookstore-name>
115               <categories>
116                 <code>1</code>
117                 <name>SciFi</name>
118               </categories>
119             </bookstore>
120           </stores>
121     dataSampleAcrossAnchors:
122       value:
123         - anchorName: bookstore1
124           dataNode:
125             test:bookstore:
126               bookstore-name: Chapters
127               categories:
128                 - code: 01
129                   name: SciFi
130                 - code: 02
131                   name: kids
132         - anchorName: bookstore2
133           dataNode:
134             test:bookstore:
135               bookstore-name: Chapters
136               categories:
137                 - code: 01
138                   name: SciFi
139                 - code: 02
140                   name: kids
141
142   parameters:
143     dataspaceNameInQuery:
144       name: dataspace-name
145       in: query
146       description: dataspace-name
147       required: true
148       schema:
149         type: string
150         example: my-dataspace
151     dataspaceNameInPath:
152       name: dataspace-name
153       in: path
154       description: dataspace-name
155       required: true
156       schema:
157         type: string
158         example: my-dataspace
159     anchorNameInPath:
160       name: anchor-name
161       in: path
162       description: anchor-name
163       required: true
164       schema:
165         type: string
166         example: my-anchor
167     schemaSetNameInQuery:
168       name: schema-set-name
169       in: query
170       description: schema-set-name
171       required: true
172       schema:
173         type: string
174         example: my-schema-set
175     schemaSetNameInPath:
176       name: schema-set-name
177       in: path
178       description: schema-set-name
179       required: true
180       schema:
181         type: string
182         example: my-schema-set
183     anchorNameInQuery:
184       name: anchor-name
185       in: query
186       description: anchor-name
187       required: true
188       schema:
189         type: string
190         example: my-anchor
191     xpathInQuery:
192       name: xpath
193       in: query
194       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html
195       required: false
196       schema:
197         type: string
198         default: /
199       examples:
200         container xpath:
201           value: /shops/bookstore
202         list attributes xpath:
203           value: /shops/bookstore/categories[@code=1]
204     requiredXpathInQuery:
205       name: xpath
206       in: query
207       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html
208       required: true
209       schema:
210         type: string
211       examples:
212         container xpath:
213           value: /shops/bookstore
214         list attributes xpath:
215           value: /shops/bookstore/categories[@code=1]
216     cpsPathInQuery:
217       name: cps-path
218       in: query
219       description: For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html
220       required: false
221       schema:
222         type: string
223         default: /
224       examples:
225         container cps path:
226           value: //bookstore
227         list attributes cps path:
228           value: //categories[@code=1]
229     includeDescendantsOptionInQuery:
230       name: include-descendants
231       in: query
232       description: include-descendants
233       required: false
234       schema:
235         type: boolean
236         default: false
237         example: false
238     observedTimestampInQuery:
239       name: observed-timestamp
240       in: query
241       description: observed-timestamp
242       required: false
243       schema:
244         type: string
245         example: '2021-03-21T00:10:34.030-0100'
246     apiVersionInPath:
247       name: apiVersion
248       in: path
249       description: apiVersion
250       required: true
251       schema:
252         type: string
253         enum: [v1, v2]
254         default: v2
255     contentTypeHeader:
256       name: Content-Type
257       in: header
258       description: Content type header
259       schema:
260         type: string
261         example: 'application/json'
262       required: true
263     descendantsInQuery:
264       name: descendants
265       in: query
266       description: Number of descendants to query. Allowed values are 'none', 'all', -1 (for all), 0 (for none) and any positive number.
267       required: false
268       schema:
269         type: string
270         default: none
271         example: 3
272     pageIndexInQuery:
273       name: pageIndex
274       in: query
275       description: page index for pagination over anchors. It must be greater then zero if provided.
276       required: false
277       schema:
278         type: integer
279         example: 1
280     pageSizeInQuery:
281       name: pageSize
282       in: query
283       description: number of records (anchors) per page. It must be greater then zero if provided.
284       required: false
285       schema:
286         type: integer
287         example: 10
288
289   responses:
290     NotFound:
291       description: The specified resource was not found
292       content:
293         application/json:
294           schema:
295             $ref: '#/components/schemas/ErrorMessage'
296           example:
297             status: 404
298             message: Resource Not Found
299             details: The requested resource is not found
300     Unauthorized:
301       description: Unauthorized
302       content:
303         application/json:
304           schema:
305             $ref: '#/components/schemas/ErrorMessage'
306           example:
307             status: 401
308             message: Unauthorized request
309             details: This request is unauthorized
310     Forbidden:
311       description: Forbidden
312       content:
313         application/json:
314           schema:
315             $ref: '#/components/schemas/ErrorMessage'
316           example:
317             status: 403
318             message: Request Forbidden
319             details: This request is forbidden
320     BadRequest:
321       description: Bad Request
322       content:
323         application/json:
324           schema:
325             $ref: '#/components/schemas/ErrorMessage'
326           example:
327             status: 400
328             message: Bad Request
329             details: The provided request is not valid
330     Conflict:
331       description: Conflict
332       content:
333         application/json:
334           schema:
335             $ref: '#/components/schemas/ErrorMessage'
336           example:
337             status: 409
338             message: Conflicting request
339             details: The request cannot be processed as the resource is in use.
340     Ok:
341       description: OK
342       content:
343         application/json:
344           schema:
345             type: object
346           examples:
347             dataSample:
348               value: ""
349     Created:
350       description: Created
351       content:
352         text/plain:
353           schema:
354             type: string
355             example: my-resource
356     CreatedV2:
357       description: Created without response body
358     InternalServerError:
359       description: Internal Server Error
360       content:
361         application/json:
362           schema:
363             $ref: "#/components/schemas/ErrorMessage"
364           example:
365             status: 500
366             message: Internal Server Error
367             details: Internal Server Error occurred
368     NoContent:
369       description: No Content
370       content: {}