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