fd02b6e564470f8d43dd32368f67a236a5b346b1
[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/RestCmHandle'
54         updatedCmHandles:
55           type: array
56           example:
57             cmHandle: my-cm-handle
58             cmHandleProperties:
59               add-my-property: add-property
60               update-my-property: updated-property
61               delete-my-property: '~'
62             publicCmHandleProperties:
63               add-my-property: add-property
64               update-my-property: updated-property
65               delete-my-property: '~'
66           items:
67             $ref: '#/components/schemas/RestCmHandle'
68         removedCmHandles:
69           type: array
70           items:
71             type: string
72             example: [my-cm-handle1, my-cm-handle2, my-cm-handle3]
73
74     RestCmHandle:
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   examples:
150     dataSampleRequest:
151         summary: Sample request
152         description: Sample request body
153         value:
154           test:bookstore:
155             bookstore-name: Chapters
156             categories:
157               - code: '01'
158                 name: SciFi
159                 books:
160                 - authors:
161                     - Iain M. Banks
162                     - Ursula K. Le Guin
163               - code: '02'
164                 name: kids
165                 books:
166                 - authors:
167                     - Philip Pullman
168
169     dataSamplePatchRequest:
170       summary: Sample patch request
171       description: Sample patch request body
172       value:
173         ietf-restconf:yang-patch:
174           patch-id: patch-1
175           edit:
176             - edit-id: edit1
177               operation: merge
178               target: /
179               value:
180                 test:bookstore:
181                   bookstore-name: Chapters
182                   categories:
183                     - code: '01'
184                       name: Science
185                       books:
186                         - authors:
187                             - Author1
188                             - Author2
189                     - code: '02'
190                       name: Arts
191                       books:
192                         - authors:
193                             - Author3
194             - edit-id: edit2
195               operation: merge
196               target: /
197               value:
198                 test:bookstore:
199                   bookstore-name: Novels
200                   categories:
201                     - code: '03'
202                       name: History
203                       books:
204                         - authors:
205                             - Iain M. Banks
206                             - Ursula K. Le Guin
207                     - code: '04'
208                       name: Fiction
209                       books:
210                         - authors:
211                             - Philip Pullman
212
213     dataSampleResponse:
214         summary: Sample response
215         description: Sample response for selecting 'sample 1'.
216         value:
217           bookstore:
218             categories:
219               - code: '01'
220                 books:
221                   - authors:
222                       - Iain M. Banks
223                       - Ursula K. Le Guin
224                 name: SciFi
225               - code: '02'
226                 books:
227                   - authors:
228                       - Philip Pullman
229                 name: kids
230
231   parameters:
232     cmHandleInPath:
233       name: cm-handle
234       in: path
235       description: The identifier for a network function, network element, subnetwork or any other cm object by managed Network CM Proxy
236       required: true
237       schema:
238         type: string
239         example: my-cm-handle
240     xpathInQuery:
241       name: xpath
242       in: query
243       description: xpath
244       required: false
245       schema:
246         type: string
247         default: /
248     requiredXpathInQuery:
249       name: xpath
250       in: query
251       description: xpath
252       required: true
253       schema:
254         type: string
255     includeDescendantsOptionInQuery:
256       name: include-descendants
257       in: query
258       description: include-descendants
259       required: false
260       schema:
261         type: boolean
262         default: false
263     cpsPathInQuery:
264       name: cps-path
265       in: query
266       description: cps-path
267       required: false
268       schema:
269         type: string
270         default: /
271     resourceIdentifierInQuery:
272       name: resourceIdentifier
273       in: query
274       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.
275       required: true
276       allowReserved: true
277       schema:
278         type: string
279       examples:
280         sample 1:
281           value:
282             resourceIdentifier: \shops\bookstore
283         sample 2:
284           value:
285             resourceIdentifier: \shops\bookstore\categories[@code=1]
286         sample 3:
287           value:
288             resourceIdentifier: parent=shops,child=bookstore
289     acceptParamInHeader:
290       name: Accept
291       in: header
292       required: false
293       description: Accept parameter for response, if accept parameter is null, that means client can accept any format.
294       schema:
295         type: string
296         enum: [ application/json, application/yang-data+json ]
297     optionsParamInQuery:
298       name: options
299       in: query
300       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.
301       required: false
302       schema:
303         type: string
304       allowReserved: true
305       examples:
306         sample 1:
307           value:
308             options: (depth=3)
309         sample 2:
310           value:
311             options: (fields=book)
312         sample 3:
313           value:
314             options: (depth=2,fields=book/authors)
315     contentParamInHeader:
316       name: Content-Type
317       in: header
318       required: false
319       description: Content parameter for request, if content parameter is null, default value is application/json.
320       schema:
321         type: string
322         default: application/json
323         example: application/yang-data+json
324
325   responses:
326     NotFound:
327       description: The specified resource was not found
328       content:
329         application/json:
330           schema:
331             $ref: '#/components/schemas/ErrorMessage'
332           example:
333             status: 400
334             message: Not found error message
335             details: Not found error details
336     Unauthorized:
337       description: Unauthorized
338       content:
339         application/json:
340           schema:
341             $ref: '#/components/schemas/ErrorMessage'
342           example:
343             status: 401
344             message: Unauthorized error message
345             details: Unauthorized error details
346     Forbidden:
347       description: Forbidden
348       content:
349         application/json:
350           schema:
351             $ref: '#/components/schemas/ErrorMessage'
352           example:
353            status: 403
354            message: Forbidden error message
355            details: Forbidden error details
356     BadRequest:
357       description: Bad Request
358       content:
359         application/json:
360           schema:
361             $ref: '#/components/schemas/ErrorMessage'
362           example:
363            status: 400 BAD_REQUEST
364            message: Bad request error message
365            details: Bad request error details
366     Conflict:
367       description: Conflict
368       content:
369         application/json:
370           schema:
371             $ref: '#/components/schemas/ErrorMessage'
372           example:
373            status: 409 CONFLICT
374            message: Conflict error message
375            details: Conflict error details
376     NotImplemented:
377       description: The given path has not been implemented
378       content:
379         application/json:
380           schema:
381             $ref: '#/components/schemas/ErrorMessage'
382           example:
383            status: 501
384            message: Not implemented error message
385            details: Not implemented error details
386     Ok:
387       description: OK
388       content:
389         application/json:
390           schema:
391             type: object
392     Created:
393       description: Created
394       content: {}
395     NoContent:
396       description: No Content
397       content: {}
398     InternalServerError:
399       description: Internal Server Error
400       content:
401         application/json:
402           schema:
403             $ref: "#/components/schemas/ErrorMessage"
404           example:
405             status: 500
406             message: Internal Server Error
407             details: Internal Server Error occurred