diff options
author | kissand <andras.zoltan.kiss@est.tech> | 2022-05-12 15:59:18 +0200 |
---|---|---|
committer | kissand <andras.zoltan.kiss@est.tech> | 2022-06-08 09:46:28 +0200 |
commit | e9ed581de0a6090c513e6fca0052b69396cb3cc8 (patch) | |
tree | ea66ec265e0544cf0037e9fe2969a5f017d9ad45 /cps-ncmp-rest/docs | |
parent | 002fb164cde7079cb3cac65a14b74fec9588ddc5 (diff) |
Merge 2 'query' end points in NCMP
- merge two endpoint for a same backend
- use xPath query instead of sql query
- modify searches endpoint to return a cmHandle object with all public
properties
- handle old (deprecated) queries
- handle public property queries
- create useful examples
- use more verbose error messages
- simplify openapi yamls
- create new query service
- change second endpoint name to a better matched name
- modify legacy tests with new requirements
- create new tests for the new scenarios
Issue-ID: CPS-1016
Change-Id: I7476e9dbd510ec93b5b48ce85d477ecb2dadffff
Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
Diffstat (limited to 'cps-ncmp-rest/docs')
-rw-r--r-- | cps-ncmp-rest/docs/openapi/components.yaml | 101 | ||||
-rwxr-xr-x | cps-ncmp-rest/docs/openapi/ncmp.yml | 20 | ||||
-rwxr-xr-x | cps-ncmp-rest/docs/openapi/openapi.yml | 6 |
3 files changed, 64 insertions, 63 deletions
diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index 5fe47e4b0f..248b1daa61 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -133,52 +133,7 @@ components: type: string example: my-property - Conditions: - type: object - properties: - conditions: - $ref: '#/components/schemas/ConditionsData' - ConditionsData: - type: array - items: - type: object - $ref: '#/components/schemas/ConditionProperties' - ConditionProperties: - properties: - name: - type: string - example: hasAllModules - conditionParameters: - $ref: '#/components/schemas/ModuleNamesAsJsonArray' - ModuleNamesAsJsonArray: - type: array - items: - type: object - $ref: '#/components/schemas/ModuleNameAsJsonObject' - example: [my-module-1, my-module-2, my-module-3] - ModuleNameAsJsonObject: - properties: - moduleName: - type: string - example: my-module - #Response Schemas - CmHandles: - type: object - properties: - cmHandles: - $ref: '#/components/schemas/CmHandleProperties' - CmHandleProperties: - type: array - items: - type: object - $ref: '#/components/schemas/CmHandleProperty' - CmHandleProperty: - properties: - cmHandleId: - type: string - example: my-cm-handle-id - RestModuleReference: type: object title: Module reference details @@ -190,15 +145,59 @@ components: type: string example: my-module-revision - CmHandleQueryRestParameters: + CmHandleQueryParameters: type: object title: Cm Handle query parameters for executing cm handle search properties: - publicCmHandleProperties: - type: object - additionalProperties: - type: string - example: Book Type + cmHandleQueryParameters: + type: array + items: + type: object + $ref: '#/components/schemas/ConditionProperties' + conditions: + deprecated: true + type: array + items: + type: object + $ref: '#/components/schemas/OldConditionProperties' + description: not necessary, it is just for backward compatibility + example: + cmHandleQueryParameters: + - conditionName: hasAllModules + conditionParameters: + - { "moduleName": "my-module-1" } + - { "moduleName": "my-module-2" } + - { "moduleName": "my-module-3" } + - conditionName: hasAllProperties + conditionParameters: + - { "Color": "yellow" } + - { "Shape": "circle" } + - { "Size": "small" } + ConditionProperties: + properties: + conditionName: + type: string + conditionParameters: + type: array + items: + type: object + additionalProperties: + type: string + OldConditionProperties: + deprecated: true + properties: + name: + type: string + conditionParameters: + type: array + items: + type: object + $ref: '#/components/schemas/ModuleNameAsJsonObject' + ModuleNameAsJsonObject: + properties: + moduleName: + type: string + example: my-module RestOutputCmHandle: type: object diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 318e6e66d9..7a894f5196 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -246,26 +246,28 @@ fetchModuleReferencesByCmHandle: 500: $ref: 'components.yaml#/components/responses/InternalServerError' -executeCmHandleSearch: +searchCmHandles: post: - description: Execute cm handle searches using 'hasAllModules' condition to get all cm handles for the given module names + description: Execute cm handle query search, to be included in the result a cm-handle must fulfill ALL the conditions listed here tags: - network-cm-proxy summary: Execute cm handle search using the available conditions - operationId: executeCmHandleSearch + operationId: searchCmHandles requestBody: required: true content: application/json: schema: - $ref: 'components.yaml#/components/schemas/Conditions' + $ref: 'components.yaml#/components/schemas/CmHandleQueryParameters' responses: 200: description: OK content: application/json: schema: - $ref: 'components.yaml#/components/schemas/CmHandles' + type: array + items: + $ref: 'components.yaml#/components/schemas/RestOutputCmHandle' 400: $ref: 'components.yaml#/components/responses/BadRequest' 401: @@ -317,19 +319,19 @@ getCmHandlePropertiesById: 500: $ref: 'components.yaml#/components/responses/InternalServerError' -queryCmHandles: +searchCmHandleIds: post: - description: Execute cm handle query search + description: Execute cm handle query search, to be included in the result a cm-handle must fulfill ALL the conditions listed here tags: - network-cm-proxy summary: Execute cm handle query upon a given set of query parameters - operationId: queryCmHandles + operationId: searchCmHandleIds requestBody: required: true content: application/json: schema: - $ref: 'components.yaml#/components/schemas/CmHandleQueryRestParameters' + $ref: 'components.yaml#/components/schemas/CmHandleQueryParameters' responses: 200: description: OK diff --git a/cps-ncmp-rest/docs/openapi/openapi.yml b/cps-ncmp-rest/docs/openapi/openapi.yml index b4082918f6..81ebf05edd 100755 --- a/cps-ncmp-rest/docs/openapi/openapi.yml +++ b/cps-ncmp-rest/docs/openapi/openapi.yml @@ -36,7 +36,7 @@ paths: $ref: 'ncmp.yml#/fetchModuleReferencesByCmHandle' /v1/ch/searches: - $ref: 'ncmp.yml#/executeCmHandleSearch' + $ref: 'ncmp.yml#/searchCmHandles' /v1/ch/{cm-handle}: $ref: 'ncmp.yml#/retrieveCmHandleDetailsById' @@ -44,5 +44,5 @@ paths: /v1/ch/{cm-handle}/properties: $ref: 'ncmp.yml#/getCmHandlePropertiesById' - /v1/data/ch/searches: - $ref: 'ncmp.yml#/queryCmHandles' + /v1/ch/id-searches: + $ref: 'ncmp.yml#/searchCmHandleIds' |