Adding examples in openapi for cps-core
1. Added examples for all parameters, request body and response body
2. Changed the response/request type to Object from String for all json objects
3. Passed json format data in all tests
4. PUT and PATCH operations at present return empty response, hence examples are changed to be in sync
Issue-ID: CPS-780
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: If6dd5bb48df4e1bbf1026eaadf315df8f972e282
diff --git a/cps-rest/docs/openapi/cpsData.yml b/cps-rest/docs/openapi/cpsData.yml
index 2b65ae4..15f8a1c 100644
--- a/cps-rest/docs/openapi/cpsData.yml
+++ b/cps-rest/docs/openapi/cpsData.yml
@@ -35,7 +35,9 @@
application/json:
schema:
type: object
- example: { "child": my_child,"leafList": "leafListElement1, leafListElement2", "leaf": my_leaf }
+ examples:
+ dataSampleResponse:
+ $ref: 'components.yml#/components/examples/dataSampleResponse'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'401':
@@ -63,7 +65,10 @@
content:
application/json:
schema:
- type: string
+ type: object
+ examples:
+ dataSampleRequest:
+ $ref: 'components.yml#/components/examples/dataSampleRequest'
responses:
'201':
$ref: 'components.yml#/components/responses/Created'
@@ -90,10 +95,13 @@
content:
application/json:
schema:
- type: string
+ type: object
+ examples:
+ dataSampleRequest:
+ $ref: 'components.yml#/components/examples/dataSampleRequest'
responses:
'200':
- $ref: 'components.yml#/components/responses/Created'
+ $ref: 'components.yml#/components/responses/Ok'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'401':
@@ -140,7 +148,10 @@
content:
application/json:
schema:
- type: string
+ type: object
+ examples:
+ dataSampleRequest:
+ $ref: 'components.yml#/components/examples/dataSampleRequest'
responses:
'201':
$ref: 'components.yml#/components/responses/Created'
@@ -167,7 +178,10 @@
content:
application/json:
schema:
- type: string
+ type: object
+ examples:
+ dataSampleRequest:
+ $ref: 'components.yml#/components/examples/dataSampleRequest'
responses:
'200':
$ref: 'components.yml#/components/responses/Ok'
@@ -216,7 +230,10 @@
content:
application/json:
schema:
- type: string
+ type: object
+ examples:
+ dataSampleRequest:
+ $ref: 'components.yml#/components/examples/dataSampleRequest'
responses:
'200':
$ref: 'components.yml#/components/responses/Ok'