diff options
Diffstat (limited to 'cps-rest')
-rw-r--r-- | cps-rest/docs/openapi/components.yml | 405 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsAdmin.yml | 232 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsAdminV1Deprecated.yml | 92 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsAdminV2.yml | 89 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsData.yml | 234 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsDataV1Deprecated.yml | 71 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsDataV2.yml | 127 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsQueryV1Deprecated.yml | 50 | ||||
-rw-r--r-- | cps-rest/docs/openapi/cpsQueryV2.yml | 78 | ||||
-rw-r--r-- | cps-rest/docs/openapi/openapi.yml | 116 | ||||
-rw-r--r-- | cps-rest/pom.xml | 28 |
11 files changed, 1520 insertions, 2 deletions
diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/docs/openapi/components.yml new file mode 100644 index 0000000000..25ef6a452a --- /dev/null +++ b/cps-rest/docs/openapi/components.yml @@ -0,0 +1,405 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021-2022 Bell Canada. +# Modifications Copyright (C) 2021-2023 Nordix Foundation +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# Modifications Copyright (C) 2022 Deutsche Telekom AG +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +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 + + DataspaceDetails: + type: object + title: Dataspace details by dataspace Name + properties: + name: + type: string + example: my-dataspace + + ErrorMessage: + type: object + title: Error + properties: + status: + type: string + message: + type: string + details: + type: string + + MultipartFile: + type: object + required: + - file + properties: + file: + type: string + description: multipartFile + format: binary + + ModuleReferences: + type: object + title: Module reference object + properties: + name: + type: string + example: my-module-reference-name + namespace: + type: string + example: my-module-reference-namespace + revision: + type: string + example: my-module-reference-revision + + SchemaSetDetails: + type: object + title: Schema set details by dataspace and schemasetName + required: + - "moduleReferences" + properties: + dataspaceName: + type: string + example: my-dataspace + moduleReferences: + type: array + items: + $ref: '#/components/schemas/ModuleReferences' + name: + type: string + example: my-schema-set + + examples: + dataSample: + value: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + dataSampleXml: + value: + <stores xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <bookstore xmlns="org:onap:ccsdk:sample"> + <bookstore-name>Chapters</bookstore-name> + <categories> + <code>1</code> + <name>SciFi</name> + <code>2</code> + <name>kids</name> + </categories> + </bookstore> + </stores> + dataSampleAcrossAnchors: + value: + - anchorName: bookstore1 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + - anchorName: bookstore2 + dataNode: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + deltaReportSample: + value: + - action: "create" + xpath: "/bookstore/categories/[@code=3]" + target-data: + code: 3, + name: "kidz" + - action: "remove" + xpath: "/bookstore/categories/[@code=1]" + source-data: + code: 1, + name: "Fiction" + - action: "replace" + xpath: "/bookstore/categories/[@code=2]" + source-data: + name: "Funny" + target-data: + name: "Comic" + + parameters: + dataspaceNameInQuery: + name: dataspace-name + in: query + description: dataspace-name + required: true + schema: + type: string + example: my-dataspace + dataspaceNameInPath: + name: dataspace-name + in: path + description: dataspace-name + required: true + schema: + type: string + example: my-dataspace + anchorNameInPath: + name: anchor-name + in: path + description: anchor-name + required: true + schema: + type: string + example: my-anchor + sourceAnchorNameInPath: + name: source-anchor-name + in: path + description: source-anchor-name + required: true + schema: + type: string + example: my-anchor + schemaSetNameInQuery: + name: schema-set-name + in: query + description: schema-set-name + required: true + schema: + type: string + example: my-schema-set + schemaSetNameInPath: + name: schema-set-name + in: path + description: schema-set-name + required: true + schema: + type: string + example: my-schema-set + anchorNameInQuery: + name: anchor-name + in: query + description: anchor-name + required: true + schema: + type: string + example: my-anchor + targetAnchorNameInQuery: + name: target-anchor-name + in: query + description: target-anchor-name + required: true + schema: + type: string + example: my-anchor + xpathInQuery: + name: xpath + in: query + description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html + required: false + schema: + type: string + default: / + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: /shops/bookstore/categories[@code=1] + requiredXpathInQuery: + name: xpath + in: query + description: For more details on xpath, please refer https://docs.onap.org/projects/onap-cps/en/latest/xpath.html + required: true + schema: + type: string + examples: + container xpath: + value: /shops/bookstore + list attributes xpath: + value: /shops/bookstore/categories[@code=1] + cpsPathInQuery: + name: cps-path + in: query + description: For more details on cps path, please refer https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html + required: false + schema: + type: string + default: / + examples: + container cps path: + value: //bookstore + list attributes cps path: + value: //categories[@code=1] + includeDescendantsOptionInQuery: + name: include-descendants + in: query + description: include-descendants + required: false + schema: + type: boolean + default: false + example: false + observedTimestampInQuery: + name: observed-timestamp + in: query + description: observed-timestamp + required: false + schema: + type: string + example: '2021-03-21T00:10:34.030-0100' + apiVersionInPath: + name: apiVersion + in: path + description: apiVersion + required: true + schema: + type: string + enum: [v1, v2] + default: v2 + contentTypeInHeader: + name: Content-Type + in: header + description: Content type in header + schema: + type: string + example: 'application/json' + required: true + descendantsInQuery: + name: descendants + in: query + description: Number of descendants to query. Allowed values are 'none', 'all', 'direct', 1 (for direct), -1 (for all), 0 (for none) and any positive number. + required: false + schema: + type: string + default: none + example: 3 + pageIndexInQuery: + name: pageIndex + in: query + description: page index for pagination over anchors. It must be greater then zero if provided. + required: false + schema: + type: integer + example: 1 + pageSizeInQuery: + name: pageSize + in: query + description: number of records (anchors) per page. It must be greater then zero if provided. + required: false + schema: + type: integer + example: 10 + + responses: + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 404 + message: Resource Not Found + details: The requested resource is not found + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 401 + message: Unauthorized request + details: This request is unauthorized + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 403 + message: Request Forbidden + details: This request is forbidden + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 400 + message: Bad Request + details: The provided request is not valid + Conflict: + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + example: + status: 409 + message: Conflicting request + details: The request cannot be processed as the resource is in use. + Ok: + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + value: "" + Created: + description: Created + content: + application/json: + schema: + type: string + example: my-resource + CreatedV2: + description: Created without response body + InternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorMessage" + example: + status: 500 + message: Internal Server Error + details: Internal Server Error occurred + NoContent: + description: No Content + content: {} diff --git a/cps-rest/docs/openapi/cpsAdmin.yml b/cps-rest/docs/openapi/cpsAdmin.yml new file mode 100644 index 0000000000..f394270dd5 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdmin.yml @@ -0,0 +1,232 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 Bell Canada. +# Modifications Copyright (C) 2021-2022 Nordix Foundation +# Modifications Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + delete: + description: Delete a dataspace + tags: + - cps-admin + summary: Delete a dataspace + operationId: deleteDataspace + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + get: + description: Read all schema sets, given a dataspace + tags: + - cps-admin + summary: Get schema sets + operationId: getSchemaSets + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/SchemaSetDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSetBySchemaSetName: + get: + description: Read a schema set given a schema set name and a dataspace + tags: + - cps-admin + summary: Get a schema set + operationId: getSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/SchemaSetDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete a schema set given a schema set name and a dataspace + tags: + - cps-admin + summary: Delete a schema set + operationId: deleteSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInPath' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + get: + description: Read all anchors, given a dataspace + tags: + - cps-admin + summary: Get anchors + operationId: getAnchors + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/AnchorDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorByDataspaceAndAnchorName: + get: + description: Read an anchor given an anchor name and a dataspace + tags: + - cps-admin + summary: Get an anchor + operationId: getAnchor + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/AnchorDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete an anchor given an anchor name and a dataspace + tags: + - cps-admin + summary: Delete an anchor + operationId: deleteAnchor + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +adminDataspaces: + get: + description: Read all dataspaces + tags: + - cps-admin + summary: Get all dataspaces + operationId: getAllDataspaces + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: 'components.yml#/components/schemas/DataspaceDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +adminDataspace: + get: + description: Read a dataspace given a dataspace name + tags: + - cps-admin + summary: Get a dataspace + operationId: getDataspace + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: 'components.yml#/components/schemas/DataspaceDetails' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml b/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml new file mode 100644 index 0000000000..c92f773c30 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdminV1Deprecated.yml @@ -0,0 +1,92 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + post: + deprecated: true + description: Create a new dataspace + tags: + - cps-admin + summary: Create a dataspace + operationId: createDataspace + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + post: + deprecated: true + description: Create a new anchor in the given dataspace + tags: + - cps-admin + summary: Create an anchor + operationId: createAnchor + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + - $ref: 'components.yml#/components/parameters/anchorNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + post: + deprecated: true + description: Create a new schema set in the given dataspace + tags: + - cps-admin + summary: Create a schema set + operationId: createSchemaSet + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: 'components.yml#/components/schemas/MultipartFile' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsAdminV2.yml b/cps-rest/docs/openapi/cpsAdminV2.yml new file mode 100644 index 0000000000..e501ad8b15 --- /dev/null +++ b/cps-rest/docs/openapi/cpsAdminV2.yml @@ -0,0 +1,89 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +dataspaces: + post: + description: Create a new dataspace + tags: + - cps-admin + summary: Create a dataspace + operationId: createDataspaceV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +anchorsByDataspace: + post: + description: Create a new anchor in the given dataspace + tags: + - cps-admin + summary: Create an anchor + operationId: createAnchorV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + - $ref: 'components.yml#/components/parameters/anchorNameInQuery' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +schemaSet: + post: + description: Create a new schema set in the given dataspace + tags: + - cps-admin + summary: Create a schema set + operationId: createSchemaSetV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery' + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: 'components.yml#/components/schemas/MultipartFile' + responses: + '201': + $ref: 'components.yml#/components/responses/CreatedV2' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsData.yml b/cps-rest/docs/openapi/cpsData.yml new file mode 100644 index 0000000000..4418a3b9b7 --- /dev/null +++ b/cps-rest/docs/openapi/cpsData.yml @@ -0,0 +1,234 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021-2022 Bell Canada. +# Modifications Copyright (C) 2021-2022 Nordix Foundation +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# Modifications Copyright (C) 2022 Deutsche Telekom AG +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +listElementByDataspaceAndAnchor: + post: + description: Add list element(s) to a list for a given anchor and dataspace + tags: + - cps-data + summary: Add list element(s) + operationId: addListElements + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + put: + description: Replace list content under a given parent, anchor and dataspace + tags: + - cps-data + summary: Replace list content + operationId: replaceListContent + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + requestBody: + required: true + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + +nodesByDataspaceAndAnchor: + post: + description: Create a node for a given anchor and dataspace + tags: + - cps-data + summary: Create a node + operationId: createNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object # Workaround to show example + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '201': + $ref: 'components.yml#/components/responses/Created' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '409': + $ref: 'components.yml#/components/responses/Conflict' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + patch: + description: Update a data node leaves for a given dataspace and anchor and a parent node xpath. This operation + is currently supported for one top level data node only. + tags: + - cps-data + summary: Update node leaves + operationId: updateNodeLeaves + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + delete: + description: Delete a datanode for a given dataspace and anchor given a node xpath. + tags: + - cps-data + summary: Delete a data node + operationId: deleteDataNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + put: + description: Replace a node with descendants for a given dataspace, anchor and a parent node xpath + tags: + - cps-data + summary: Replace a node with descendants + operationId: replaceNode + parameters: + - $ref: 'components.yml#/components/parameters/apiVersionInPath' + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + - $ref: 'components.yml#/components/parameters/contentTypeInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + application/xml: + schema: + type: object + xml: + name: stores + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleXml' + responses: + '200': + $ref: 'components.yml#/components/responses/Ok' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsDataV1Deprecated.yml b/cps-rest/docs/openapi/cpsDataV1Deprecated.yml new file mode 100644 index 0000000000..3941856422 --- /dev/null +++ b/cps-rest/docs/openapi/cpsDataV1Deprecated.yml @@ -0,0 +1,71 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022-2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodeByDataspaceAndAnchor: + get: + description: Get a node with an option to retrieve all the children for a given anchor and dataspace + deprecated: true + tags: + - cps-data + summary: Get a node + operationId: getNodeByDataspaceAndAnchor + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +listElementByDataspaceAndAnchor: + delete: + description: Delete one or all list element(s) for a given anchor and dataspace + deprecated: true + tags: + - cps-data + summary: Delete one or all list element(s) + operationId: deleteListOrListElement + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/requiredXpathInQuery' + - $ref: 'components.yml#/components/parameters/observedTimestampInQuery' + responses: + '204': + $ref: 'components.yml#/components/responses/NoContent' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' diff --git a/cps-rest/docs/openapi/cpsDataV2.yml b/cps-rest/docs/openapi/cpsDataV2.yml new file mode 100644 index 0000000000..d5a8ef3891 --- /dev/null +++ b/cps-rest/docs/openapi/cpsDataV2.yml @@ -0,0 +1,127 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2022-2024 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodeByDataspaceAndAnchor: + get: + description: Get a node with an option to retrieve all the children for a given anchor and dataspace + tags: + - cps-data + summary: Get a node + operationId: getNodeByDataspaceAndAnchorV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +delta: + get: + description: Get delta between two anchors within a given dataspace + tags: + - cps-data + summary: Get delta between anchors in the same dataspace + operationId: getDeltaByDataspaceAndAnchors + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/sourceAnchorNameInPath' + - $ref: 'components.yml#/components/parameters/targetAnchorNameInQuery' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/deltaReportSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + post: + description: Get delta between an anchor in a dataspace and JSON payload + tags: + - cps-data + summary: Get delta between an anchor and JSON payload + operationId: getDeltaByDataspaceAnchorAndPayload + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/sourceAnchorNameInPath' + - $ref: 'components.yml#/components/parameters/xpathInQuery' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + json: + type: object + example: + test:bookstore: + bookstore-name: Chapters + categories: + - code: 01 + name: SciFi + - code: 02 + name: kids + file: + type: string + format: binary + required: + - json + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/deltaReportSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '401': + $ref: 'components.yml#/components/responses/Unauthorized' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError'
\ No newline at end of file diff --git a/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml b/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml new file mode 100644 index 0000000000..9db2823994 --- /dev/null +++ b/cps-rest/docs/openapi/cpsQueryV1Deprecated.yml @@ -0,0 +1,50 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation +# Modifications Copyright (c) 2022 Bell Canada. +# Modifications Copyright (c) 2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodesByDataspaceAndAnchorAndCpsPath: + get: + description: Query data nodes for the given dataspace and anchor using CPS path + tags: + - cps-query + summary: Query data nodes + deprecated: true + operationId: getNodesByDataspaceAndAnchorAndCpsPath + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath diff --git a/cps-rest/docs/openapi/cpsQueryV2.yml b/cps-rest/docs/openapi/cpsQueryV2.yml new file mode 100644 index 0000000000..7f0ceff768 --- /dev/null +++ b/cps-rest/docs/openapi/cpsQueryV2.yml @@ -0,0 +1,78 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +nodesByDataspaceAndAnchorAndCpsPath: + get: + description: Query data nodes for the given dataspace and anchor using CPS path + tags: + - cps-query + summary: Query data nodes + operationId: getNodesByDataspaceAndAnchorAndCpsPathV2 + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/anchorNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSample' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath + +nodesByDataspaceAndCpsPath: + get: + description: Query data nodes for the given dataspace across anchors using CPS path + tags: + - cps-query + summary: Query data nodes across anchors + operationId: getNodesByDataspaceAndCpsPath + parameters: + - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' + - $ref: 'components.yml#/components/parameters/cpsPathInQuery' + - $ref: 'components.yml#/components/parameters/descendantsInQuery' + - $ref: 'components.yml#/components/parameters/pageIndexInQuery' + - $ref: 'components.yml#/components/parameters/pageSizeInQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + examples: + dataSample: + $ref: 'components.yml#/components/examples/dataSampleAcrossAnchors' + '400': + $ref: 'components.yml#/components/responses/BadRequest' + '403': + $ref: 'components.yml#/components/responses/Forbidden' + '500': + $ref: 'components.yml#/components/responses/InternalServerError' + x-codegen-request-body-name: xpath diff --git a/cps-rest/docs/openapi/openapi.yml b/cps-rest/docs/openapi/openapi.yml new file mode 100644 index 0000000000..70f06fbee2 --- /dev/null +++ b/cps-rest/docs/openapi/openapi.yml @@ -0,0 +1,116 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021-2023 Nordix Foundation +# Modifications Copyright (C) 2021 Pantheon.tech +# Modifications Copyright (C) 2021 Bell Canada. +# Modifications Copyright (C) 2022-2024 TechMahindra Ltd. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +openapi: 3.0.3 +info: + title: ONAP Open API v3 Configuration Persistence Service + description: Configuration Persistence Service is a Model Driven Generic Database + version: "3.5.2" + contact: + name: ONAP + url: "https://onap.readthedocs.io" + email: "onap-discuss@lists.onap.org" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0" + +servers: + - url: /cps/api +components: + securitySchemes: + basicAuth: + type: http + scheme: basic +tags: + - name: cps-admin + description: cps Admin + - name: cps-data + description: cps Data +paths: + + /v1/dataspaces: + $ref: 'cpsAdminV1Deprecated.yml#/dataspaces' + + /{apiVersion}/dataspaces: + $ref: 'cpsAdmin.yml#/dataspaces' + + /v2/dataspaces: + $ref: 'cpsAdminV2.yml#/dataspaces' + + /{apiVersion}/admin/dataspaces: + $ref: 'cpsAdmin.yml#/adminDataspaces' + + /{apiVersion}/admin/dataspaces/{dataspace-name}: + $ref: 'cpsAdmin.yml#/adminDataspace' + + /v1/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdminV1Deprecated.yml#/anchorsByDataspace' + + /v2/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdminV2.yml#/anchorsByDataspace' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors: + $ref: 'cpsAdmin.yml#/anchorsByDataspace' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}: + $ref: 'cpsAdmin.yml#/anchorByDataspaceAndAnchorName' + + /v1/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdminV1Deprecated.yml#/schemaSet' + + /v2/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdminV2.yml#/schemaSet' + + /{apiVersion}/dataspaces/{dataspace-name}/schema-sets: + $ref: 'cpsAdmin.yml#/schemaSet' + + /{apiVersion}/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}: + $ref: 'cpsAdmin.yml#/schemaSetBySchemaSetName' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: + $ref: 'cpsDataV1Deprecated.yml#/nodeByDataspaceAndAnchor' + + /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/node: + $ref: 'cpsDataV2.yml#/nodeByDataspaceAndAnchor' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes: + $ref: 'cpsData.yml#/nodesByDataspaceAndAnchor' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: + $ref: 'cpsDataV1Deprecated.yml#/listElementByDataspaceAndAnchor' + + /{apiVersion}/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes: + $ref: 'cpsData.yml#/listElementByDataspaceAndAnchor' + + /v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta: + $ref: 'cpsDataV2.yml#/delta' + + /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: + $ref: 'cpsQueryV1Deprecated.yml#/nodesByDataspaceAndAnchorAndCpsPath' + + /v2/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query: + $ref: 'cpsQueryV2.yml#/nodesByDataspaceAndAnchorAndCpsPath' + + /v2/dataspaces/{dataspace-name}/nodes/query: + $ref: 'cpsQueryV2.yml#/nodesByDataspaceAndCpsPath' + +security: + - basicAuth: [] diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml index f115fdfd52..4bcb01af4c 100644 --- a/cps-rest/pom.xml +++ b/cps-rest/pom.xml @@ -141,7 +141,7 @@ <goal>generate</goal> </goals> <configuration> - <inputSpec>${project.basedir}/../docs/api/swagger/cps/openapi.yaml</inputSpec> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> <invokerPackage>org.onap.cps.rest.controller</invokerPackage> <modelPackage>org.onap.cps.rest.model</modelPackage> <apiPackage>org.onap.cps.rest.api</apiPackage> @@ -165,7 +165,7 @@ </goals> <phase>compile</phase> <configuration> - <inputSpec>${project.basedir}/../docs/api/swagger/cps/openapi.yaml</inputSpec> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> <generatorName>openapi-yaml</generatorName> <configOptions> <outputFile>openapi.yaml</outputFile> @@ -174,6 +174,30 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>compile</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-core</outputDirectory> + <resources> + <resource> + <directory>${project.basedir}/target/generated-sources/openapi/</directory> + <includes> + <include>openapi.yaml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> |