Adding examples in openapi for cps-core
[cps.git] / cps-rest / docs / openapi / cpsData.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021 Bell Canada.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18
19 nodeByDataspaceAndAnchor:
20   get:
21     description: Get a node with an option to retrieve all the children for a given anchor and dataspace
22     tags:
23       - cps-data
24     summary: Get a node
25     operationId: getNodeByDataspaceAndAnchor
26     parameters:
27       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
28       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
29       - $ref: 'components.yml#/components/parameters/xpathInQuery'
30       - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
31     responses:
32       '200':
33         description: OK
34         content:
35           application/json:
36             schema:
37               type: object
38             examples:
39               dataSampleResponse:
40                 $ref: 'components.yml#/components/examples/dataSampleResponse'
41       '400':
42         $ref: 'components.yml#/components/responses/BadRequest'
43       '401':
44         $ref: 'components.yml#/components/responses/Unauthorized'
45       '403':
46         $ref: 'components.yml#/components/responses/Forbidden'
47       '404':
48         $ref: 'components.yml#/components/responses/NotFound'
49     x-codegen-request-body-name: xpath
50
51 listElementByDataspaceAndAnchor:
52   post:
53     description: Add list element(s) to a list for a given anchor and dataspace
54     tags:
55       - cps-data
56     summary: Add list element(s)
57     operationId: addListElements
58     parameters:
59       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
60       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
61       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
62       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
63     requestBody:
64       required: true
65       content:
66         application/json:
67           schema:
68             type: object
69           examples:
70             dataSampleRequest:
71               $ref: 'components.yml#/components/examples/dataSampleRequest'
72     responses:
73       '201':
74         $ref: 'components.yml#/components/responses/Created'
75       '400':
76         $ref: 'components.yml#/components/responses/BadRequest'
77       '401':
78         $ref: 'components.yml#/components/responses/Unauthorized'
79       '403':
80         $ref: 'components.yml#/components/responses/Forbidden'
81
82   put:
83     description: Replace list content under a given parent, anchor and dataspace
84     tags:
85       - cps-data
86     summary: Replace list content
87     operationId: replaceListContent
88     parameters:
89       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
90       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
91       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
92       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
93     requestBody:
94       required: true
95       content:
96         application/json:
97           schema:
98             type: object
99           examples:
100             dataSampleRequest:
101               $ref: 'components.yml#/components/examples/dataSampleRequest'
102     responses:
103       '200':
104         $ref: 'components.yml#/components/responses/Ok'
105       '400':
106         $ref: 'components.yml#/components/responses/BadRequest'
107       '401':
108         $ref: 'components.yml#/components/responses/Unauthorized'
109       '403':
110         $ref: 'components.yml#/components/responses/Forbidden'
111
112   delete:
113     description: Delete one or all list element(s) for a given anchor and dataspace
114     deprecated: true
115     tags:
116       - cps-data
117     summary: Delete one or all list element(s)
118     operationId: deleteListOrListElement
119     parameters:
120       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
121       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
122       - $ref: 'components.yml#/components/parameters/requiredXpathInQuery'
123       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
124     responses:
125       '204':
126         $ref: 'components.yml#/components/responses/NoContent'
127       '400':
128         $ref: 'components.yml#/components/responses/BadRequest'
129       '401':
130         $ref: 'components.yml#/components/responses/Unauthorized'
131       '403':
132         $ref: 'components.yml#/components/responses/Forbidden'
133
134 nodesByDataspaceAndAnchor:
135   post:
136     description: Create a node for a given anchor and dataspace
137     tags:
138       - cps-data
139     summary: Create a node
140     operationId: createNode
141     parameters:
142       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
143       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
144       - $ref: 'components.yml#/components/parameters/xpathInQuery'
145       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
146     requestBody:
147       required: true
148       content:
149         application/json:
150           schema:
151             type: object
152           examples:
153             dataSampleRequest:
154               $ref: 'components.yml#/components/examples/dataSampleRequest'
155     responses:
156       '201':
157         $ref: 'components.yml#/components/responses/Created'
158       '400':
159         $ref: 'components.yml#/components/responses/BadRequest'
160       '401':
161         $ref: 'components.yml#/components/responses/Unauthorized'
162       '403':
163         $ref: 'components.yml#/components/responses/Forbidden'
164
165   patch:
166     description: Update a data node leaves for a given dataspace and anchor and a parent node xpath
167     tags:
168       - cps-data
169     summary: Update node leaves
170     operationId: updateNodeLeaves
171     parameters:
172       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
173       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
174       - $ref: 'components.yml#/components/parameters/xpathInQuery'
175       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
176     requestBody:
177       required: true
178       content:
179         application/json:
180           schema:
181             type: object
182           examples:
183             dataSampleRequest:
184               $ref: 'components.yml#/components/examples/dataSampleRequest'
185     responses:
186       '200':
187         $ref: 'components.yml#/components/responses/Ok'
188       '400':
189         $ref: 'components.yml#/components/responses/BadRequest'
190       '401':
191         $ref: 'components.yml#/components/responses/Unauthorized'
192       '403':
193         $ref: 'components.yml#/components/responses/Forbidden'
194
195   delete:
196     description: Delete a datanode for a given dataspace and anchor given a node xpath.
197     tags:
198       - cps-data
199     summary: Delete a data node
200     operationId: deleteDataNode
201     parameters:
202       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
203       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
204       - $ref: 'components.yml#/components/parameters/xpathInQuery'
205       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
206     responses:
207       '204':
208         $ref: 'components.yml#/components/responses/NoContent'
209       '400':
210         $ref: 'components.yml#/components/responses/BadRequest'
211       '401':
212         $ref: 'components.yml#/components/responses/Unauthorized'
213       '403':
214         $ref: 'components.yml#/components/responses/Forbidden'
215
216
217   put:
218     description: Replace a node with descendants for a given dataspace, anchor and a parent node xpath
219     tags:
220       - cps-data
221     summary: Replace a node with descendants
222     operationId: replaceNode
223     parameters:
224       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
225       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
226       - $ref: 'components.yml#/components/parameters/xpathInQuery'
227       - $ref: 'components.yml#/components/parameters/observedTimestampInQuery'
228     requestBody:
229       required: true
230       content:
231         application/json:
232           schema:
233             type: object
234           examples:
235             dataSampleRequest:
236               $ref: 'components.yml#/components/examples/dataSampleRequest'
237     responses:
238       '200':
239         $ref: 'components.yml#/components/responses/Ok'
240       '400':
241         $ref: 'components.yml#/components/responses/BadRequest'
242       '401':
243         $ref: 'components.yml#/components/responses/Unauthorized'
244       '403':
245         $ref: 'components.yml#/components/responses/Forbidden'