From 78913b0ff24646b1a26dccc87f4e43808b22fc05 Mon Sep 17 00:00:00 2001 From: Pelayo Torres Date: Thu, 19 Dec 2024 10:35:52 +0100 Subject: [PATCH] apiStatus deleted when apiStatusMonitoring is not supported --- .../published_apis/core/serviceapidescriptions.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py index 1f3b525..3b44e9a 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/core/serviceapidescriptions.py @@ -120,7 +120,9 @@ class PublishServiceOperations(Resource): vendor_specific, serviceapidescription_dict) rec.update(serviceapidescription_dict) - + if not ServiceAPIDescription.return_supp_feat_dict(rec.get("supported_features"))["ApiStatusMonitoring"] and rec.get("api_status", None) is not None: + rec.pop('api_status') + serviceapidescription_dict.pop('api_status') mycol.insert_one(rec) self.auth_manager.add_auth_service(api_id, apf_id) @@ -267,6 +269,10 @@ class PublishServiceOperations(Resource): service_api_description["apf_id"] = serviceapidescription_old["apf_id"] service_api_description["onboarding_date"] = serviceapidescription_old["onboarding_date"] service_api_description["api_id"] = serviceapidescription_old["api_id"] + + if not ServiceAPIDescription.return_supp_feat_dict(service_api_description.get("supported_features"))["ApiStatusMonitoring"] and service_api_description.get("api_status", None) is not None: + service_api_description.pop('api_status') + result = mycol.find_one_and_replace( serviceapidescription_old, @@ -344,6 +350,9 @@ class PublishServiceOperations(Resource): patch_service_api_description = clean_empty(patch_service_api_description) if api_status: patch_service_api_description["api_status"]=api_status + + if not ServiceAPIDescription.return_supp_feat_dict(serviceapidescription_old.get("supported_features"))["ApiStatusMonitoring"] and patch_service_api_description.get("api_status", None) is not None: + patch_service_api_description.pop('api_status') result = mycol.find_one_and_update( my_query, -- GitLab