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