Fix: update documentation for CPS-2428 notification subscription APIs 68/142668/4
authorArpit Singh <AS00745003@techmahindra.com>
Wed, 10 Dec 2025 12:25:38 +0000 (17:55 +0530)
committerArpit Singh <AS00745003@techmahindra.com>
Thu, 11 Dec 2025 11:46:57 +0000 (17:16 +0530)
Three APIs were added to manage CPS notifications:
- Create notification subscription
- Get notification subscription
- Delete notification subscription

Swagger examples were outdated and did not reflect the correct fields.
Updated documentation to ensure accurate examples for successful API execution.

- Added missing Javadoc in notification subscription class for better clarity.

Issue-ID: CPS-3094
Change-Id: I740b7721d8cfe4cea38a9da014b99989e3e13027
Signed-off-by: Arpit Singh <AS00745003@techmahindra.com>
cps-rest/docs/openapi/components.yml
cps-rest/docs/openapi/cpsAdminV2.yml
cps-service/src/main/java/org/onap/cps/api/CpsNotificationService.java

index 93c2584..b2938bc 100644 (file)
@@ -277,12 +277,22 @@ components:
             name: "Funny"
           target-data:
             name: "Comic"
-    NotificationSubscriptionsDataSample:
+    notificationSubscriptionRequestSample:
+      value:
+        dataspace:
+          - name: my-dataspace
+            anchors:
+              anchor:
+                - name: my-anchor
+                  xpaths:
+                    xpath:
+                      - path: /shops/bookstore
+    notificationSubscriptionResponseSample:
       value:
         cps-notification-subscriptions:dataspaces:
           dataspace:
-            - name: dataspace01
-            - name: dataspace02
+            - name: my-dataspace
+            - name: bookstore-dataspace
   parameters:
     dataspaceNameInQuery:
       name: dataspace-name
@@ -370,10 +380,10 @@ components:
         type: string
         default: /dataspaces
       examples:
-        subscription by dataspace xpath:
+        dataspace xpath:
+          value: /dataspaces
+        anchor xpath:
           value: /dataspaces/dataspace[@name='dataspace01']
-        subscription by anchor xpath:
-          value: /dataspaces/dataspace[@name='dataspace01']/anchors/anchor[@name='anchor01']
     requiredXpathInQuery:
       name: xpath
       in: query
index af2572a..7c3b4d6 100644 (file)
@@ -103,7 +103,7 @@ notificationSubscription:
         content:
           application/json:
             schema:
-              $ref: 'components.yml#/components/examples/NotificationSubscriptionsDataSample'
+              $ref: 'components.yml#/components/examples/notificationSubscriptionResponseSample'
       '400':
         $ref: 'components.yml#/components/responses/BadRequest'
       '403':
@@ -128,7 +128,7 @@ notificationSubscription:
             type: object
           examples:
             dataSample:
-              $ref: 'components.yml#/components/examples/NotificationSubscriptionsDataSample'
+              $ref: 'components.yml#/components/examples/notificationSubscriptionRequestSample'
     responses:
       '201':
         $ref: 'components.yml#/components/responses/CreatedV2'
index ae43775..cc96a64 100644 (file)
@@ -25,11 +25,36 @@ import java.util.Map;
 
 public interface CpsNotificationService {
 
+    /**
+     * Creates a notification subscription for a given xpath. The dataspacename and anchor details are provided as part
+     * of the notification subscription JSON.
+     *
+     * @param notificationSubscriptionAsJson  notification subscription in JSON format
+     * @param xpath                           the location where the notification subscription is to be created
+     */
     void createNotificationSubscription(String notificationSubscriptionAsJson, String xpath);
 
+    /**
+     * Deletes a notification subscription for a given xpath.
+     *
+     * @param xpath the location where the notification subscription is to be deleted
+     */
     void deleteNotificationSubscription(String xpath);
 
+    /**
+     * Checks if notification is enabled for a given dataspace and anchor.
+     *
+     * @param dataspaceName the dataspace name
+     * @param anchorName    the anchor name
+     * @return true if notification is enabled, false otherwise
+     */
     boolean isNotificationEnabled(String dataspaceName, String anchorName);
 
+    /**
+     * Retrieves notification subscription for a given xpath.
+     *
+     * @param xpath the location where the notification subscription is to be retrieved
+     * @return list of notification subscriptions as map
+     */
     List<Map<String, Object>> getNotificationSubscription(String xpath);
 }