[pygeoapi] Question on suspicious bug in API.execute_process() / BaseProcessor.execute()

Francesco Martinelli francesco.martinelli at ingv.it
Mon Dec 11 03:25:07 PST 2023


I have a question on the returned parameter from the following method:
*BaseProcessor.execute()*,
and how it is used from *API.execute_process()*.

The inline documentation for *BaseProcessor.execute()* says: "*returns:
tuple of MIME type and process response*"
What I am interested in is the "*process response*".

*BaseProcessor.execute()* is called by *BaseManager.execute_process()*
(indirectly through *_execute_handler_sync()* ),
which pass back to the caller (*API.execute_process()* ) the "*process
response*" unchanged.

If the *execute-request* had the parameter *"response": "raw"* or undefined
(whch defauls to *"raw"*),
then *API.execute_process()*, if *mime_type == 'application/json',*
assumes the "*process response*" (i.e. actual variable *response*) is an
object, and *converts the object to a string* to be returned as *content*,
in all other cases  *API.execute_process()* returns the original "*process
response*" unchanged (i.e. assuming it is a string).

To my understanding *the above is not correct*:
if the mime_type = 'application/json' then the "process response" *should
be a string* representing an object, *not an object*.
Even more: any "*process response*" returned by *BaseProcessor.execute()*
should be a *string*, coded according to the *mime_type*,
and in case of an *execute-request* with *"response"="raw"*, the "*process
response*" should be returned unchanged as "*content*" from
*API.execute_process()*.

Specifically about Mime application/json: "This file type is a data
interchange format that is text-based" (ref.
https://mimeapplication.net/json)


In any case I would like to have some feedback in case I missed something,
before rising the above as a bug issue.

I would also propose to specify in the inline documentation for
*BaseProcessor.execute()* the types of the returned items into the tuple
(string, string):


Thank you,
Francesco

--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pygeoapi/attachments/20231211/7829a5fe/attachment.htm>


More information about the pygeoapi mailing list