Adding examples in openapi for cps-core
[cps.git] / cps-rest / docs / openapi / components.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 components:
20   schemas:
21
22     AnchorDetails:
23       type: object
24       title: Anchor details by anchor Name
25       properties:
26         name:
27           type: string
28           example: my-anchor
29         dataspaceName:
30           type: string
31           example: my-dataspace
32         schemaSetName:
33           type: string
34           example: my-schema-set
35
36     ErrorMessage:
37       type: object
38       title: Error
39       properties:
40         status:
41           type: string
42         message:
43           type: string
44         details:
45           type: string
46
47     MultipartFile:
48       type: object
49       required:
50         - file
51       properties:
52         file:
53           type: string
54           description: multipartFile
55           format: binary
56           example:  'https://github.com/onap/cps/blob/master/cps-service/src/test/resources/bookstore.yang'
57
58     ModuleReferences:
59       type: object
60       title: Module reference object
61       properties:
62         name:
63           type: string
64           example: my-module-reference-name
65         namespace:
66           type: string
67           example: my-module-reference-namespace
68         revision:
69           type: string
70           example: my-module-reference-revision
71
72     SchemaSetDetails:
73       type: object
74       title: Schema set details by dataspace and schemasetName
75       properties:
76         dataspaceName:
77           type: string
78           example: my-dataspace
79         moduleReferences:
80           type: array
81           items:
82             $ref: '#/components/schemas/ModuleReferences'
83         name:
84           type: string
85           example: my-schema-set
86
87   examples:
88     dataSampleRequest:
89       value:
90         test:bookstore:
91           bookstore-name: Chapters
92           categories:
93             - code: 01
94               name: SciFi
95             - code: 02
96               name: kids
97
98     dataSampleResponse:
99       summary: The data node returned does not include the root node. This is being investigated as a part of CPS-461
100       value:
101           bookstore-name: Chapters
102           categories:
103             - code: 01
104               name: SciFi
105             - code: 02
106               name: kids
107
108   parameters:
109     dataspaceNameInQuery:
110       name: dataspace-name
111       in: query
112       description: dataspace-name
113       required: true
114       schema:
115         type: string
116         example: my-dataspace
117     dataspaceNameInPath:
118       name: dataspace-name
119       in: path
120       description: dataspace-name
121       required: true
122       schema:
123         type: string
124         example: my-dataspace
125     anchorNameInPath:
126       name: anchor-name
127       in: path
128       description: anchor-name
129       required: true
130       schema:
131         type: string
132         example: my-anchor
133     schemaSetNameInQuery:
134       name: schema-set-name
135       in: query
136       description: schema-set-name
137       required: true
138       schema:
139         type: string
140         example: my-schema-set
141     schemaSetNameInPath:
142       name: schema-set-name
143       in: path
144       description: schema-set-name
145       required: true
146       schema:
147         type: string
148         example: my-schema-set
149     anchorNameInQuery:
150       name: anchor-name
151       in: query
152       description: anchor-name
153       required: true
154       schema:
155         type: string
156         example: my-anchor
157     xpathInQuery:
158       name: xpath
159       in: query
160       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html
161       required: false
162       schema:
163         type: string
164         default: /
165       examples:
166         container xpath:
167           value: /shops/bookstore
168         list attributes xpath:
169           value: /shops/bookstore/categories[@code=1]
170     requiredXpathInQuery:
171       name: xpath
172       in: query
173       description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html
174       required: true
175       schema:
176         type: string
177       examples:
178         container xpath:
179           value: /shops/bookstore
180         list attributes xpath:
181           value: /shops/bookstore/categories[@code=1]
182     cpsPathInQuery:
183       name: cps-path
184       in: query
185       description: For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html
186       required: false
187       schema:
188         type: string
189         default: /
190       examples:
191         container cps path:
192           value: //bookstore
193         list attributes cps path:
194           value: //categories[@code=1]
195     includeDescendantsOptionInQuery:
196       name: include-descendants
197       in: query
198       description: include-descendants
199       required: false
200       schema:
201         type: boolean
202         default: false
203         example: false
204     observedTimestampInQuery:
205       name: observed-timestamp
206       in: query
207       description: observed-timestamp
208       required: false
209       schema:
210         type: string
211         example: '2021-03-21T00:10:34.030-0100'
212
213   responses:
214     NotFound:
215       description: The specified resource was not found
216       content:
217         application/json:
218           schema:
219             $ref: '#/components/schemas/ErrorMessage'
220           example:
221             status: 404
222             message: Resource Not Found
223             details: The requested resource is not found
224     Unauthorized:
225       description: Unauthorized
226       content:
227         application/json:
228           schema:
229             $ref: '#/components/schemas/ErrorMessage'
230           example:
231             status: 401
232             message: Unauthorized request
233             details: This request is unauthorized
234     Forbidden:
235       description: Forbidden
236       content:
237         application/json:
238           schema:
239             $ref: '#/components/schemas/ErrorMessage'
240           example:
241             status: 403
242             message: Request Forbidden
243             details: This request is forbidden
244     BadRequest:
245       description: Bad Request
246       content:
247         application/json:
248           schema:
249             $ref: '#/components/schemas/ErrorMessage'
250           example:
251             status: 400
252             message: Bad Request
253             details: The provided request is not valid
254     Conflict:
255       description: Conflict
256       content:
257         application/json:
258           schema:
259             $ref: '#/components/schemas/ErrorMessage'
260           example:
261             status: 409
262             message: Conflicting request
263             details: The request cannot be processed as the resource is in use.
264     Ok:
265       description: OK
266       content:
267         application/json:
268           schema:
269             type: object
270           examples:
271             dataSampleResponse:
272               value: ""
273     Created:
274       description: Created
275       content:
276         text/plain:
277           schema:
278             type: string
279             example: my-resource
280     NoContent:
281       description: No Content
282       content: {}