From 30811ec8979ff50a116c69e86ef25315cdc2c2e7 Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Thu, 19 Sep 2024 16:54:55 +0300 Subject: [PATCH 1/4] First draft version of extensibility feature (for publish api) --- .../controllers/default_controller.py | 35 +++++++++++++++++-- .../core/serviceapidescriptions.py | 17 +++++++-- .../models/service_api_description.py | 17 +++++++++ 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py index 2b2217b..b7f1d84 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py @@ -75,10 +75,39 @@ def apf_id_service_apis_post(apf_id, body): # noqa: E501 :rtype: Union[ServiceAPIDescription, Tuple[ServiceAPIDescription, int], Tuple[ServiceAPIDescription, int, Dict[str, str]] """ current_app.logger.info("Publishing service") - if connexion.request.is_json: - body = ServiceAPIDescription.from_dict(connexion.request.get_json()) # noqa: E501 - res = service_operations.add_serviceapidescription(apf_id, body) + # TODO read supported features + supp_feat_dict = ServiceAPIDescription.return_supp_feat_dict(body['supportedFeatures']) + current_app.logger.info(supp_feat_dict) + + vendor_specific_list = [] + + if connexion.request.is_json: + # TODO check if VendorExt feature is on and deviate the flow + if supp_feat_dict['VendorExt']: + current_app.logger.info("VendorExt is True") + # ########## Edit ServiceAPIDescription object + # current_app.logger.info(connexion.request.get_json()) + # body = ServiceAPIDescription(connexion.request.get_json()) + # current_app.logger.info(body) + # ########## Edit ServiceAPIDescription object + + # ########## Add the vendor-specific attributes to database sperately + aef_profile_array = body['aefProfiles'] + vendor_specific = [] + for profile in aef_profile_array: + vendor_specific.append((profile['aefId'], key, val) for key, val in profile.items() if 'vendorSpecific' in key) + for duet in vendor_specific: + duet_lst = list(duet) + vendor_specific_list.append(duet_lst) + # current_app.logger.info(duet_lst[0][0]) + # current_app.logger.info(duet_lst[0][1]) + # current_app.logger.info(duet_lst[0][2]) + # ########## Add the vendor-specific attributes to database separately + body = ServiceAPIDescription.from_dict(connexion.request.get_json()) + + current_app.logger.info(vendor_specific_list) + res = service_operations.add_serviceapidescription(apf_id, body, vendor_specific_list) return res 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 f32b7b2..99ca69a 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 @@ -78,7 +78,7 @@ class PublishServiceOperations(Resource): current_app.logger.error(exception + "::" + str(e)) return internal_server_error(detail=exception, cause=str(e)) - def add_serviceapidescription(self, apf_id, serviceapidescription): + def add_serviceapidescription(self, apf_id, serviceapidescription, vendor_specific): mycol = self.db.get_col_by_name(self.db.service_api_descriptions) @@ -102,7 +102,19 @@ class PublishServiceOperations(Resource): rec = dict() rec['apf_id'] = apf_id rec['onboarding_date'] = datetime.now() - rec.update(serviceapidescription.to_dict()) + serviceapidescription_dict = serviceapidescription.to_dict() + if vendor_specific: + for trio in vendor_specific: + trio_lst = list(trio) + current_app.logger.info(trio_lst) + for profile in serviceapidescription_dict['aef_profiles']: + current_app.logger.info(trio_lst[0][0]) + current_app.logger.info(trio_lst[0][1]) + current_app.logger.info(trio_lst[0][2]) + current_app.logger.info(profile) + if profile['aef_id'] == trio_lst[0][0]: + profile[trio_lst[0][1]] = trio_lst[0][2] + rec.update(serviceapidescription_dict) mycol.insert_one(rec) @@ -110,6 +122,7 @@ class PublishServiceOperations(Resource): current_app.logger.debug("Service inserted in database") + # TODO Have to return the vendor specific object res = make_response(object=serialize_clean_camel_case(serviceapidescription), status=201) res.headers['Location'] = "http://localhost:8080/published-apis/v1/" + \ str(apf_id) + "/service-apis/" + str(api_id) diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py index 396b9fa..d6a514e 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py @@ -93,6 +93,23 @@ class ServiceAPIDescription(Model): self._ccf_id = ccf_id self._api_prov_name = api_prov_name + @classmethod + def return_supp_feat_dict(cls, supp_feat): + supp_feat_in_hex = int(supp_feat, 16) + supp_feat_in_bin = bin(supp_feat_in_hex)[2:] + + return { + "VendorExt": True if supp_feat_in_bin[0] == "1" else False, + "RNAA": True if supp_feat_in_bin[1] == "1" else False, + "EdgeApp_2": True if supp_feat_in_bin[2] == "1" else False, + "ApiStatusMonitoring": True if supp_feat_in_bin[3] == "1" else False, + "ProtocDataFormats_Ext1": True if supp_feat_in_bin[4] == "1" else False, + "MultipleCustomOperations": True if supp_feat_in_bin[5] == "1" else False, + "ExtendedIntfDesc": True if supp_feat_in_bin[6] == "1" else False, + "PatchUpdate": True if supp_feat_in_bin[7] == "1" else False, + "ApiSupportedFeaturePublishing": True if supp_feat_in_bin[9] == "1" else False, + } + @classmethod def from_dict(cls, dikt) -> 'ServiceAPIDescription': """Returns the dict as a model -- GitLab From 5d728dc76692b822803002d186eb73156c423a58 Mon Sep 17 00:00:00 2001 From: Stavros Date: Wed, 25 Sep 2024 16:06:54 +0300 Subject: [PATCH 2/4] Draft implementation of extensibility feature in Discover API --- .../controllers/default_controller.py | 17 +++++++++++++++++ .../service_apis/core/discoveredapis.py | 12 ++++++++++-- .../service_apis/models/discovered_apis.py | 11 +++++++++++ .../controllers/default_controller.py | 2 +- .../core/serviceapidescriptions.py | 9 +++++---- 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py b/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py index d8b6c64..8f21b76 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py @@ -14,6 +14,7 @@ from service_apis import util from ..core.discoveredapis import DiscoverApisOperations from flask import Response, request, current_app +import json discover_apis = DiscoverApisOperations() @@ -67,8 +68,24 @@ def all_service_apis_get(api_invoker_id, api_name=None, api_version=None, comm_t if request.is_json: service_kpis = ServiceKpis.from_dict(request.get_json()()) # noqa: E501 current_app.logger.info("Discovering service apis") + current_app.logger.info(request.args) query_params = {"api_name":api_name, "api_version":api_version, "comm_type":comm_type, "protocol":protocol, "aef_id":aef_id, "data_format":data_format, "api_cat":api_cat, "supported_features":supported_features, "api_supported_features":api_supported_features} + + # current_app.logger.info(supported_features) + if supported_features is not None: + supp_feat_dict = DiscoveredAPIs.return_supp_feat_dict(supported_features) + if supp_feat_dict['VendSpecQueryParams']: + # current_app.logger.info("**************************") + # current_app.logger.info(request.args) + # current_app.logger.info("**************************") + for q_params in request.args: + # current_app.logger.info(q_params) + # current_app.logger.info(request.args[q_params]) + if "vend-spec" in q_params: + query_params[q_params] = json.loads(request.args[q_params]) + + # current_app.logger.info(query_params) response = discover_apis.get_discoveredapis(api_invoker_id, query_params) return response diff --git a/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py b/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py index 487ceb1..9a9104d 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py +++ b/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py @@ -27,10 +27,18 @@ class DiscoverApisOperations(Resource): "protocol":"aef_profiles.0.protocol", "aef_id":"aef_profiles.0.aef_id", "data_format":"aef_profiles.0.data_format", "api_cat":"service_api_category", "supported_features":"supported_features", "api_supported_features":"api_supp_feats"} + # current_app.logger.info(query_params) for param in query_params: if query_params[param] is not None: - my_params.append({quey_params_name[param]: query_params[param]}) - + if "vend-spec" in param: + current_app.logger.info("vend-spec in param") + attribute_path = query_params[param]["target"].split('/') + attribute = "aef_profiles.0." + attribute_path[1] + "." + attribute_path[2] + my_params.append({attribute: query_params[param]["value"]}) + else: + my_params.append({quey_params_name[param]: query_params[param]}) + + # current_app.logger.info(my_params) if my_params: my_query = {"$and": my_params} diff --git a/services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py b/services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py index e780b70..a3d5e36 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py +++ b/services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py @@ -30,6 +30,17 @@ class DiscoveredAPIs(Model): self._service_api_descriptions = service_api_descriptions + @classmethod + def return_supp_feat_dict(cls, supp_feat): + supp_feat_in_hex = int(supp_feat, 16) + supp_feat_in_bin = bin(supp_feat_in_hex)[2:] + + return { + "RNAA": True if supp_feat_in_bin[0] == "1" else False, + "VendSpecQueryParams": True if supp_feat_in_bin[1] == "1" else False, + "ApiSupportedFeatureQuery": True if supp_feat_in_bin[2] == "1" else False, + } + @classmethod def from_dict(cls, dikt) -> 'DiscoveredAPIs': """Returns the dict as a model diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py index b8daf23..7d46f1f 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py @@ -78,7 +78,7 @@ def apf_id_service_apis_post(apf_id, body): # noqa: E501 current_app.logger.info("Publishing service") supp_feat_dict = ServiceAPIDescription.return_supp_feat_dict(body['supportedFeatures']) - current_app.logger.info(supp_feat_dict) + # current_app.logger.info(supp_feat_dict) vendor_specific_list = [] 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 f76c32d..d1f286a 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 @@ -109,10 +109,11 @@ class PublishServiceOperations(Resource): # current_app.logger.info(vend_spec_lst) for profile in serviceapidescription_dict['aef_profiles']: if profile['aef_id'] == vend_spec_lst[0][0]: - # snake_case the vendor specific key and value to store in mongo - key = ''.join(['_'+ i.lower() if i.isupper() else i for i in vend_spec_lst[0][1]]).lstrip('_').replace("-", "_") - value = dict_to_camel_case(vend_spec_lst[0][2]) - profile[key] = value + # ##### snake_case the vendor specific key and value to store in mongo + # key = ''.join(['_'+ i.lower() if i.isupper() else i for i in vend_spec_lst[0][1]]).lstrip('_').replace("-", "_") + # value = dict_to_camel_case(vend_spec_lst[0][2]) + # profile[key] = value + profile[vend_spec_lst[0][1]] = vend_spec_lst[0][2] rec.update(serviceapidescription_dict) mycol.insert_one(rec) -- GitLab From 5a55cb476a4d2356218711a3f66ec799a14cf174 Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Thu, 26 Sep 2024 16:55:15 +0300 Subject: [PATCH 3/4] Fix Discover functionality to seach all over the ServiceAPIDescription object --- .../controllers/default_controller.py | 22 ++++++---------- .../service_apis/core/discoveredapis.py | 25 ++++++++++++++----- .../controllers/default_controller.py | 18 ++++++------- .../core/serviceapidescriptions.py | 10 ++++---- 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py b/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py index 8f21b76..13fd27e 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Discover_Service_API/service_apis/controllers/default_controller.py @@ -56,36 +56,28 @@ def all_service_apis_get(api_invoker_id, api_name=None, api_version=None, comm_t :rtype: Union[DiscoveredAPIs, Tuple[DiscoveredAPIs, int], Tuple[DiscoveredAPIs, int, Dict[str, str]] """ if request.is_json: - comm_type = CommunicationType.from_dict(request.get_json()()) # noqa: E501 + comm_type = CommunicationType.from_dict(request.get_json()()) # noqa: E501 if request.is_json: - protocol = Protocol.from_dict(request.get_json()()) # noqa: E501 + protocol = Protocol.from_dict(request.get_json()()) # noqa: E501 if request.is_json: - data_format = DataFormat.from_dict(request.get_json()()) # noqa: E501 + data_format = DataFormat.from_dict(request.get_json()()) # noqa: E501 if request.is_json: - preferred_aef_loc = AefLocation.from_dict(request.get_json()()) # noqa: E501 + preferred_aef_loc = AefLocation.from_dict(request.get_json()()) # noqa: E501 if request.is_json: - ue_ip_addr = IpAddrInfo.from_dict(request.get_json()()) # noqa: E501 + ue_ip_addr = IpAddrInfo.from_dict(request.get_json()()) # noqa: E501 if request.is_json: - service_kpis = ServiceKpis.from_dict(request.get_json()()) # noqa: E501 + service_kpis = ServiceKpis.from_dict(request.get_json()()) # noqa: E501 current_app.logger.info("Discovering service apis") - current_app.logger.info(request.args) query_params = {"api_name":api_name, "api_version":api_version, "comm_type":comm_type, "protocol":protocol, "aef_id":aef_id, "data_format":data_format, "api_cat":api_cat, "supported_features":supported_features, "api_supported_features":api_supported_features} - # current_app.logger.info(supported_features) if supported_features is not None: supp_feat_dict = DiscoveredAPIs.return_supp_feat_dict(supported_features) if supp_feat_dict['VendSpecQueryParams']: - # current_app.logger.info("**************************") - # current_app.logger.info(request.args) - # current_app.logger.info("**************************") - for q_params in request.args: - # current_app.logger.info(q_params) - # current_app.logger.info(request.args[q_params]) + for q_params in request.args: if "vend-spec" in q_params: query_params[q_params] = json.loads(request.args[q_params]) - # current_app.logger.info(query_params) response = discover_apis.get_discoveredapis(api_invoker_id, query_params) return response diff --git a/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py b/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py index 9a9104d..e07e4a1 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py +++ b/services/TS29222_CAPIF_Discover_Service_API/service_apis/core/discoveredapis.py @@ -4,6 +4,7 @@ from ..core.responses import internal_server_error, forbidden_error ,make_respon from ..models.discovered_apis import DiscoveredAPIs from ..util import serialize_clean_camel_case from ..core.resources import Resource +import json class DiscoverApisOperations(Resource): @@ -23,22 +24,34 @@ class DiscoverApisOperations(Resource): my_params = [] my_query = {} - quey_params_name = {"api_name":"api_name", "api_version":"aef_profiles.0.versions.0.api_version", "comm_type":"aef_profiles.0.versions.0.resources.0.comm_type", - "protocol":"aef_profiles.0.protocol", "aef_id":"aef_profiles.0.aef_id", "data_format":"aef_profiles.0.data_format", - "api_cat":"service_api_category", "supported_features":"supported_features", "api_supported_features":"api_supp_feats"} + # QPV = Query Parameter Value + query_params_name = { + "api_name": "api_name", + "api_version": '{"aef_profiles": {"$elemMatch": {"versions" : {"$elemMatch": {"api_version": "QPV"}}}}}', + "comm_type": '{"aef_profiles": {"$elemMatch": {"versions" : {"$elemMatch": {"resources": {"$elemMatch": {"comm_type":"QPV"}}}}}}}', + "protocol": '{"aef_profiles": {"$elemMatch": {"protocol":"QPV"}}}', + "aef_id": '{"aef_profiles": {"$elemMatch": {"aef_id":"QPV"}}}', + "data_format": '{"aef_profiles": {"$elemMatch": {"data_format":"QPV"}}}', + "api_cat": "service_api_category", + "supported_features": "supported_features", + "api_supported_features": "api_supp_feats" + } - # current_app.logger.info(query_params) for param in query_params: + current_app.logger.info(query_params[param]) if query_params[param] is not None: if "vend-spec" in param: current_app.logger.info("vend-spec in param") attribute_path = query_params[param]["target"].split('/') attribute = "aef_profiles.0." + attribute_path[1] + "." + attribute_path[2] my_params.append({attribute: query_params[param]["value"]}) + elif param in ["api_version", "comm_type", "protocol", "aef_id", "data_format"]: + current_app.logger.info(query_params_name[param]) + current_app.logger.info(query_params_name[param].replace("QPV", query_params[param])) + my_params.append(json.loads(query_params_name[param].replace("QPV", query_params[param]))) else: - my_params.append({quey_params_name[param]: query_params[param]}) + my_params.append({query_params_name[param]: query_params[param]}) - # current_app.logger.info(my_params) if my_params: my_query = {"$and": my_params} diff --git a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py index 7d46f1f..699208b 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py +++ b/services/TS29222_CAPIF_Publish_Service_API/published_apis/controllers/default_controller.py @@ -78,25 +78,23 @@ def apf_id_service_apis_post(apf_id, body): # noqa: E501 current_app.logger.info("Publishing service") supp_feat_dict = ServiceAPIDescription.return_supp_feat_dict(body['supportedFeatures']) - # current_app.logger.info(supp_feat_dict) - - vendor_specific_list = [] + vendor_specific = [] if request.is_json: if supp_feat_dict['VendorExt']: aef_profile_array = body['aefProfiles'] - vendor_specific = [] - for profile in aef_profile_array: - vendor_specific.append((profile['aefId'], key, val) for key, val in profile.items() if 'vendorSpecific' in key) - for vend_spec in vendor_specific: - vend_spec_lst = list(vend_spec) - vendor_specific_list.append(vend_spec_lst) + for (profile,i) in zip(aef_profile_array, range(len(aef_profile_array))): + for key, val in profile.items(): + if 'vendorSpecific' in key: + vendor_specific.append((i, key, val)) + body = ServiceAPIDescription.from_dict(request.get_json()) - res = service_operations.add_serviceapidescription(apf_id, body, vendor_specific_list) + res = service_operations.add_serviceapidescription(apf_id, body, vendor_specific) return res + @cert_validation() def apf_id_service_apis_service_api_id_delete(service_api_id, apf_id): # noqa: E501 """apf_id_service_apis_service_api_id_delete 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 d1f286a..79ea878 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 @@ -104,16 +104,16 @@ class PublishServiceOperations(Resource): rec['onboarding_date'] = datetime.now() serviceapidescription_dict = serviceapidescription.to_dict() if vendor_specific: + current_app.logger.debug("VendExt") for vend_spec in vendor_specific: - vend_spec_lst = list(vend_spec) - # current_app.logger.info(vend_spec_lst) - for profile in serviceapidescription_dict['aef_profiles']: - if profile['aef_id'] == vend_spec_lst[0][0]: + current_app.logger.info(vend_spec) + for (profile,i) in zip(serviceapidescription_dict['aef_profiles'], range(len(serviceapidescription_dict['aef_profiles']))): + if i == vend_spec[0]: # ##### snake_case the vendor specific key and value to store in mongo # key = ''.join(['_'+ i.lower() if i.isupper() else i for i in vend_spec_lst[0][1]]).lstrip('_').replace("-", "_") # value = dict_to_camel_case(vend_spec_lst[0][2]) # profile[key] = value - profile[vend_spec_lst[0][1]] = vend_spec_lst[0][2] + profile[vend_spec[1]] = vend_spec[2] rec.update(serviceapidescription_dict) mycol.insert_one(rec) -- GitLab From 9febf0ee4c254bb8738c95f0cb2ff93781432afb Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Mon, 30 Sep 2024 09:55:53 +0300 Subject: [PATCH 4/4] Remove unneccessary logs --- .../published_apis/core/serviceapidescriptions.py | 8 -------- 1 file changed, 8 deletions(-) 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 79ea878..c1792b4 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 @@ -104,15 +104,9 @@ class PublishServiceOperations(Resource): rec['onboarding_date'] = datetime.now() serviceapidescription_dict = serviceapidescription.to_dict() if vendor_specific: - current_app.logger.debug("VendExt") for vend_spec in vendor_specific: - current_app.logger.info(vend_spec) for (profile,i) in zip(serviceapidescription_dict['aef_profiles'], range(len(serviceapidescription_dict['aef_profiles']))): if i == vend_spec[0]: - # ##### snake_case the vendor specific key and value to store in mongo - # key = ''.join(['_'+ i.lower() if i.isupper() else i for i in vend_spec_lst[0][1]]).lstrip('_').replace("-", "_") - # value = dict_to_camel_case(vend_spec_lst[0][2]) - # profile[key] = value profile[vend_spec[1]] = vend_spec[2] rec.update(serviceapidescription_dict) @@ -122,8 +116,6 @@ class PublishServiceOperations(Resource): current_app.logger.debug("Service inserted in database") - # TODO Have to return the vendor specific object - # res = make_response(object=serialize_clean_camel_case(serviceapidescription), status=201) res = make_response(object=clean_n_camel_case(serviceapidescription_dict), status=201) res.headers['Location'] = "http://localhost:8080/published-apis/v1/" + \ str(apf_id) + "/service-apis/" + str(api_id) -- GitLab