From d000733344658e79e8a384e724349bdb644d7c62 Mon Sep 17 00:00:00 2001 From: "puthuparambil.aditya" Date: Wed, 8 Dec 2021 18:53:39 +0000 Subject: Define response objects(schemas) in cps-ncmp Issue-ID: CPS-559 Signed-off-by: puthuparambil.aditya Change-Id: Id181f2a1b9554118f5e7464c95e873f09fc908eb --- cps-ncmp-rest/docs/openapi/components.yaml | 22 ++++++++---- cps-ncmp-rest/docs/openapi/ncmp.yml | 54 ++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 24 deletions(-) (limited to 'cps-ncmp-rest/docs') diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index 719282b3e7..d9bd49a097 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -48,7 +48,6 @@ components: type: array items: $ref: '#/components/schemas/RestCmHandle' - example: [my-cm-handle1, my-cm-handle2, my-cm-handle3] updatedCmHandles: type: array items: @@ -121,6 +120,17 @@ components: type: string example: my-cm-handle-id + ModuleReference: + type: object + title: Module reference details + properties: + moduleName: + type: string + example: my-module-name + revision: + type: string + example: my-module-revision + examples: dataSampleRequest: summary: Sample request @@ -134,7 +144,6 @@ components: books: - authors: - Iain M. Banks - - authors: - Ursula K. Le Guin - code: '02' name: kids @@ -150,14 +159,15 @@ components: categories: - code: '01' books: - - {} - - {} + - authors: + - Iain M. Banks + - Ursula K. Le Guin name: SciFi - code: '02' books: - - {} + - authors: + - Philip Pullman name: kids - bookstore-name: Chapters parameters: cmHandleInPath: diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 673eb0b3cc..ece3c3a0d7 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -82,7 +82,10 @@ nodesByCmHandleAndXpath: content: application/json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 201: $ref: 'components.yaml#/components/responses/Created' @@ -110,7 +113,10 @@ nodesByCmHandleAndXpath: content: application/json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 200: $ref: 'components.yaml#/components/responses/Ok' @@ -138,7 +144,10 @@ nodesByCmHandleAndXpath: content: application/json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 200: $ref: 'components.yaml#/components/responses/Ok' @@ -167,7 +176,10 @@ listNodeByCmHandleAndXpath: content: application/json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 201: $ref: 'components.yaml#/components/responses/Created' @@ -256,13 +268,16 @@ resourceDataForPassthroughRunning: content: application/json: schema: - type: string + type: object examples: dataSampleRequest: $ref: 'components.yaml#/components/examples/dataSampleRequest' application/yang-data+json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 201: $ref: 'components.yaml#/components/responses/Created' @@ -290,13 +305,16 @@ resourceDataForPassthroughRunning: content: application/json: schema: - type: string + type: object examples: dataSampleRequest: $ref: 'components.yaml#/components/examples/dataSampleRequest' application/yang-data+json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 200: $ref: 'components.yaml#/components/responses/Ok' @@ -325,6 +343,9 @@ resourceDataForPassthroughRunning: application/json: schema: type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 200: $ref: 'components.yaml#/components/responses/Ok' @@ -352,7 +373,10 @@ resourceDataForPassthroughRunning: content: application/json: schema: - type: string + type: object + examples: + dataSampleRequest: + $ref: 'components.yaml#/components/examples/dataSampleRequest' responses: 204: $ref: 'components.yaml#/components/responses/NoContent' @@ -381,15 +405,9 @@ fetchModuleReferencesByCmHandle: content: application/json: schema: - type: object - examples: - moduleReferencesResponse: - summary: Sample response - value: - - moduleName: my-module-name - revision: yyyy-mm-dd - - moduleName: my-module-name-2 - revision: yyyy-mm-dd + type: array + items: + $ref: 'components.yaml#/components/schemas/ModuleReference' 400: $ref: 'components.yaml#/components/responses/BadRequest' 401: -- cgit 1.2.3-korg