Merge "Async: NCMP Rest impl. including Request ID generation"
[cps.git] / cps-ncmp-rest / docs / openapi / components.yaml
1 #  ============LICENSE_START=======================================================
2 #  Copyright (C) 2021-2022 Nordix Foundation
3 #  Modifications Copyright (C) 2021 Pantheon.tech
4 #  ================================================================================
5 #  Licensed under the Apache License, Version 2.0 (the "License");
6 #  you may not use this file except in compliance with the License.
7 #  You may obtain a copy of the License at
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #  Unless required by applicable law or agreed to in writing, software
12 #  distributed under the License is distributed on an "AS IS" BASIS,
13 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #  See the License for the specific language governing permissions and
15 #  limitations under the License.
16 #
17 #  SPDX-License-Identifier: Apache-2.0
18 #  ============LICENSE_END=========================================================
19
20 components:
21   schemas:
22     # Common Schemas
23     ErrorMessage:
24       type: object
25       title: Error
26       properties:
27         status:
28           type: string
29         message:
30           type: string
31         details:
32           type: string
33
34     # Request Schemas
35     RestDmiPluginRegistration:
36       type: object
37       properties:
38         dmiPlugin:
39           type: string
40           example: my-dmi-plugin
41           default: ""
42         dmiDataPlugin:
43           type: string
44           example: my-dmi-data-plugin
45           default: ""
46         dmiModelPlugin:
47           type: string
48           example: my-dmi-model-plugin
49           default: ""
50         createdCmHandles:
51           type: array
52           items:
53             $ref: '#/components/schemas/RestInputCmHandle'
54         updatedCmHandles:
55           type: array
56           items:
57             $ref: '#/components/schemas/RestInputCmHandle'
58             example:
59               cmHandle: my-cm-handle
60               cmHandleProperties:
61                 add-my-property: add-property
62                 update-my-property: updated-property
63                 delete-my-property: '~'
64               publicCmHandleProperties:
65                 add-my-property: add-property
66                 update-my-property: updated-property
67                 delete-my-property: '~'
68         removedCmHandles:
69           type: array
70           items:
71             type: string
72           example: [my-cm-handle1, my-cm-handle2, my-cm-handle3]
73
74     RestInputCmHandle:
75       required:
76         - cmHandle
77       type: object
78       properties:
79         cmHandle:
80           type: string
81           example: my-cm-handle
82         cmHandleProperties:
83             $ref: '#/components/schemas/RestCmHandleProperties'
84         publicCmHandleProperties:
85             $ref: '#/components/schemas/RestCmHandleProperties'
86     RestCmHandleProperties:
87         type: object
88         additionalProperties:
89             type: string
90             example: my-property
91
92     Conditions:
93       type: object
94       properties:
95         conditions:
96           $ref: '#/components/schemas/ConditionsData'
97     ConditionsData:
98       type: array
99       items:
100         type: object
101         $ref: '#/components/schemas/ConditionProperties'
102     ConditionProperties:
103       properties:
104         name:
105           type: string
106           example: hasAllModules
107         conditionParameters:
108           $ref: '#/components/schemas/ModuleNamesAsJsonArray'
109     ModuleNamesAsJsonArray:
110       type: array
111       items:
112         type: object
113         $ref: '#/components/schemas/ModuleNameAsJsonObject'
114         example: [my-module-1, my-module-2, my-module-3]
115     ModuleNameAsJsonObject:
116         properties:
117           moduleName:
118             type: string
119             example: my-module
120
121     #Response Schemas
122     CmHandles:
123       type: object
124       properties:
125         cmHandles:
126           $ref: '#/components/schemas/CmHandleProperties'
127     CmHandleProperties:
128       type: array
129       items:
130         type: object
131         $ref: '#/components/schemas/CmHandleProperty'
132     CmHandleProperty:
133       properties:
134         cmHandleId:
135           type: string
136           example: my-cm-handle-id
137
138     ModuleReference:
139       type: object
140       title: Module reference details
141       properties:
142         moduleName:
143           type: string
144           example: my-module-name
145         revision:
146           type: string
147           example: my-module-revision
148
149     RestOutputCmHandle:
150       type: object
151       title: CM handle Details
152       properties:
153         cmHandle:
154           type: string
155           example: my-cm-handle1
156         publicCmHandleProperties:
157           $ref: '#/components/schemas/CmHandlePublicProperties'
158     CmHandlePublicProperties:
159       type: array
160       items:
161         type: object
162         additionalProperties:
163           type: string
164           example: Book Type
165
166   examples:
167     dataSampleRequest:
168         summary: Sample request
169         description: Sample request body
170         value:
171           test:bookstore:
172             bookstore-name: Chapters
173             categories:
174               - code: '01'
175                 name: SciFi
176                 books:
177                 - authors:
178                     - Iain M. Banks
179                     - Ursula K. Le Guin
180               - code: '02'
181                 name: kids
182                 books:
183                 - authors:
184                     - Philip Pullman
185
186     dataSamplePatchRequest:
187       summary: Sample patch request
188       description: Sample patch request body
189       value:
190         ietf-restconf:yang-patch:
191           patch-id: patch-1
192           edit:
193             - edit-id: edit1
194               operation: merge
195               target: /
196               value:
197                 test:bookstore:
198                   bookstore-name: Chapters
199                   categories:
200                     - code: '01'
201                       name: Science
202                       books:
203                         - authors:
204                             - Author1
205                             - Author2
206                     - code: '02'
207                       name: Arts
208                       books:
209                         - authors:
210                             - Author3
211             - edit-id: edit2
212               operation: merge
213               target: /
214               value:
215                 test:bookstore:
216                   bookstore-name: Novels
217                   categories:
218                     - code: '03'
219                       name: History
220                       books:
221                         - authors:
222                             - Iain M. Banks
223                             - Ursula K. Le Guin
224                     - code: '04'
225                       name: Fiction
226                       books:
227                         - authors:
228                             - Philip Pullman
229
230     dataSampleResponse:
231         summary: Sample response
232         description: Sample response for selecting 'sample 1'.
233         value:
234           bookstore:
235             categories:
236               - code: '01'
237                 books:
238                   - authors:
239                       - Iain M. Banks
240                       - Ursula K. Le Guin
241                 name: SciFi
242               - code: '02'
243                 books:
244                   - authors:
245                       - Philip Pullman
246                 name: kids
247
248   parameters:
249     cmHandleInPath:
250       name: cm-handle
251       in: path
252       description: The identifier for a network function, network element, subnetwork or any other cm object by managed Network CM Proxy
253       required: true
254       schema:
255         type: string
256         example: my-cm-handle
257     xpathInQuery:
258       name: xpath
259       in: query
260       description: xpath
261       required: false
262       schema:
263         type: string
264         default: /
265     requiredXpathInQuery:
266       name: xpath
267       in: query
268       description: xpath
269       required: true
270       schema:
271         type: string
272     includeDescendantsOptionInQuery:
273       name: include-descendants
274       in: query
275       description: include-descendants
276       required: false
277       schema:
278         type: boolean
279         default: false
280     cpsPathInQuery:
281       name: cps-path
282       in: query
283       description: cps-path
284       required: false
285       schema:
286         type: string
287         default: /
288     resourceIdentifierInQuery:
289       name: resourceIdentifier
290       in: query
291       description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but it can really be anything.
292       required: true
293       allowReserved: true
294       schema:
295         type: string
296       examples:
297         sample 1:
298           value:
299             resourceIdentifier: \shops\bookstore
300         sample 2:
301           value:
302             resourceIdentifier: \shops\bookstore\categories[@code=1]
303         sample 3:
304           value:
305             resourceIdentifier: parent=shops,child=bookstore
306     acceptParamInHeader:
307       name: Accept
308       in: header
309       required: false
310       description: Accept parameter for response, if accept parameter is null, that means client can accept any format.
311       schema:
312         type: string
313         enum: [ application/json, application/yang-data+json ]
314     optionsParamInQuery:
315       name: options
316       in: query
317       description: options parameter in query, it is mandatory to wrap key(s)=value(s) in parenthesis'()'. The format of options parameter depend on the associated DMI Plugin implementation.
318       required: false
319       schema:
320         type: string
321       allowReserved: true
322       examples:
323         sample 1:
324           value:
325             options: (depth=3)
326         sample 2:
327           value:
328             options: (fields=book)
329         sample 3:
330           value:
331             options: (depth=2,fields=book/authors)
332     topicParamInQuery:
333       name: topic
334       in: query
335       description: topic parameter in query.
336       required: false
337       schema:
338         type: string
339       allowReserved: true
340       examples:
341         sample 1:
342           value:
343             topic: my-topic-name
344     contentParamInHeader:
345       name: Content-Type
346       in: header
347       required: false
348       description: Content parameter for request, if content parameter is null, default value is application/json.
349       schema:
350         type: string
351         default: application/json
352         example: application/yang-data+json
353
354   responses:
355     NotFound:
356       description: The specified resource was not found
357       content:
358         application/json:
359           schema:
360             $ref: '#/components/schemas/ErrorMessage'
361           example:
362             status: 400
363             message: Not found error message
364             details: Not found error details
365     Unauthorized:
366       description: Unauthorized
367       content:
368         application/json:
369           schema:
370             $ref: '#/components/schemas/ErrorMessage'
371           example:
372             status: 401
373             message: Unauthorized error message
374             details: Unauthorized error details
375     Forbidden:
376       description: Forbidden
377       content:
378         application/json:
379           schema:
380             $ref: '#/components/schemas/ErrorMessage'
381           example:
382            status: 403
383            message: Forbidden error message
384            details: Forbidden error details
385     BadRequest:
386       description: Bad Request
387       content:
388         application/json:
389           schema:
390             $ref: '#/components/schemas/ErrorMessage'
391           example:
392            status: 400 BAD_REQUEST
393            message: Bad request error message
394            details: Bad request error details
395     Conflict:
396       description: Conflict
397       content:
398         application/json:
399           schema:
400             $ref: '#/components/schemas/ErrorMessage'
401           example:
402            status: 409 CONFLICT
403            message: Conflict error message
404            details: Conflict error details
405     NotImplemented:
406       description: The given path has not been implemented
407       content:
408         application/json:
409           schema:
410             $ref: '#/components/schemas/ErrorMessage'
411           example:
412            status: 501
413            message: Not implemented error message
414            details: Not implemented error details
415     Ok:
416       description: OK
417       content:
418         application/json:
419           schema:
420             type: object
421     Created:
422       description: Created
423       content: {}
424     NoContent:
425       description: No Content
426       content: {}
427     InternalServerError:
428       description: Internal Server Error
429       content:
430         application/json:
431           schema:
432             $ref: "#/components/schemas/ErrorMessage"
433           example:
434             status: 500
435             message: Internal Server Error
436             details: Internal Server Error occurred