Description
Issue Description:
I integrated a "ckanext-right_time_context" extnesion with CKAN.
When I executed the "resource_create" API, it returned the below error :
[Tue Aug 15 17:33:43.157707 2023] [wsgi:error] [pid 137:tid 140601585772288] [remote 10.26.3.147:03245] return self._serialize_resource(resource)
[Tue Aug 15 17:33:43.157710 2023] [wsgi:error] [pid 137:tid 140601585772288] [remote 10.26.3.147:03245] File '/usr/lib/ckan/default/src/ckanext-right_time_context/ckanext/right_time_context/plugin.py', line 175 in _serialize_resource
[Tue Aug 15 17:33:43.157713 2023] [wsgi:error] [pid 137:tid 140601585772288] [remote 10.26.3.147:03245] if resource['format'] == NGSI_REG_FORMAT:
[Tue Aug 15 17:33:43.157715 2023] [wsgi:error] [pid 137:tid 140601585772288] [remote 10.26.3.147:03245] KeyError: 'format'
Investigation:
On the investigation, I found that "format" key has not been passed in the curl command. As per the document "format" key is optional in resource_create API.
Further when I investigated in the right-time-context source code, I found that in the following file "/usr/lib/ckan/default/src/ckanext-right_time_context/ckanext/right_time_context/plugin.py" at line no 175, currently below condition is checked.
if resource['format'] == NGSI_REG_FORMAT:
When resource_create API is executed without "format" key, it returns the error because format key is not there.
Expected Behaviour:
resource_create API should be working without passing format key in the curl command.