summaryrefslogtreecommitdiffstats
path: root/cps-rest/docs/openapi
diff options
context:
space:
mode:
authorJosephKeenan <joseph.keenan@est.tech>2021-06-08 13:16:37 +0100
committerJosephKeenan <joseph.keenan@est.tech>2021-06-15 14:56:06 +0100
commitc6865f33336bcdcd79eb2659b1a7df130aee9452 (patch)
treea157d762ce2ff0100164683236a44e0088e986ad /cps-rest/docs/openapi
parente3f7305a421e075eef97d4eefdd590ca95a2a4f6 (diff)
[OpenAPI] Implemented example as per example wiki page for getting anchors based on dataspace
-moved components from cpsAdmin.yml to components.yml -refactored variable for anchor details list in AdminRestController.java -reintrocuded paramter for anchorsByDataspace -refactored variables in AdminRestController.java getAnchors() to be more intuitive -refactored AdminRestController.java to use modelmapper and removed extra conversion code. Also modified AdminRestControllerSpec.groovy to use ModelMapper as Spy rather than a Mock -added responses for getAnchor & getSchemaSet -added javadoc for AdminRestController.java public methods -refactored schemaDetils pararmeter from dataSpasceName to name for CSOT tests & added some code review comments Issue-ID: CPS-429 Change-Id: I01d4113313c9a23d9a7e0e96e46b90f9ac767f24 Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
Diffstat (limited to 'cps-rest/docs/openapi')
-rw-r--r--cps-rest/docs/openapi/components.yml44
-rw-r--r--cps-rest/docs/openapi/cpsAdmin.yml22
2 files changed, 62 insertions, 4 deletions
diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/docs/openapi/components.yml
index 5a21a730ef..a337a244b8 100644
--- a/cps-rest/docs/openapi/components.yml
+++ b/cps-rest/docs/openapi/components.yml
@@ -1,5 +1,20 @@
components:
schemas:
+
+ AnchorDetails:
+ type: object
+ title: Anchor details by anchor Name
+ properties:
+ name:
+ type: string
+ example: my_anchor
+ dataspaceName:
+ type: string
+ example: my_dataspace
+ schemaSetName:
+ type: string
+ example: my_schema_set
+
ErrorMessage:
type: object
title: Error
@@ -24,6 +39,35 @@ components:
format: binary
example: http://example.com/examples/example.yang
+ ModuleReferences:
+ type: object
+ title: Module reference object
+ properties:
+ name:
+ type: string
+ example: module_reference_name
+ namespace:
+ type: string
+ example: module_reference_namespace
+ revision:
+ type: string
+ example: module_reference_revision
+
+ SchemaSetDetails:
+ type: object
+ title: Schema set details by dataspace and schemasetName
+ properties:
+ dataspaceName:
+ type: string
+ example: my_dataspace
+ moduleReferences:
+ type: array
+ items:
+ $ref: '#/components/schemas/ModuleReferences'
+ name:
+ type: string
+ example: my_schema_set
+
parameters:
dataspaceNameInQuery:
name: dataspace-name
diff --git a/cps-rest/docs/openapi/cpsAdmin.yml b/cps-rest/docs/openapi/cpsAdmin.yml
index cf26299283..1a2e65f7d4 100644
--- a/cps-rest/docs/openapi/cpsAdmin.yml
+++ b/cps-rest/docs/openapi/cpsAdmin.yml
@@ -78,7 +78,11 @@ schemaSetBySchemaSetName:
- $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
responses:
'200':
- $ref: 'components.yml#/components/responses/Ok'
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: 'components.yml#/components/schemas/SchemaSetDetails'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'401':
@@ -120,7 +124,13 @@ anchorsByDataspace:
- $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
responses:
'200':
- $ref: 'components.yml#/components/responses/Ok'
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: 'components.yml#/components/schemas/AnchorDetails'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'401':
@@ -162,7 +172,11 @@ anchorByDataspaceAndAnchorName:
- $ref: 'components.yml#/components/parameters/anchorNameInPath'
responses:
'200':
- $ref: 'components.yml#/components/responses/Ok'
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: 'components.yml#/components/schemas/AnchorDetails'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'401':
@@ -189,4 +203,4 @@ anchorByDataspaceAndAnchorName:
'401':
$ref: 'components.yml#/components/responses/Unauthorized'
'403':
- $ref: 'components.yml#/components/responses/Forbidden'
+ $ref: 'components.yml#/components/responses/Forbidden' \ No newline at end of file