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