geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
490 stars 260 forks source link

Processes - Unexpected returned value when response='document' #1579

Closed francescoingv closed 2 months ago

francescoingv commented 7 months ago

Description Issuing a synchronous execution request, specifying the response to be 'document', returns a (JSON) string that is different from what is returned when retrieving the 'job-results'

Steps to Reproduce After having set the process manager to be TinyDB in PYGEOAPI_CONFIG issue the following call (note the --verbose flag to get the 'Location'): curl --verbose localhost:5000/processes/hello-world/execution -H 'Content-Type: application/json' -d '{"response": "document", "inputs": {"message": "Message", "name": "My Name"}}' which returns:

[...]
< Location: http://localhost:5000/jobs/5f98b4aa-dbc3-11ee-9007-cdecccd8e112
[...]
{
    "outputs":[
        {
            "id":"echo",
            "value":"Hello My Name! Message"
        }
    ]
}

Then issue the following call: curl http://localhost:5000/jobs/5f98b4aa-dbc3-11ee-9007-cdecccd8e112/results?f=json which returns:

{
    "id": "echo",
    "value": "Hello My Name! Message"
}

Expected behavior Either the first call should return

[...]
< Location: http://localhost:5000/jobs/5f98b4aa-dbc3-11ee-9007-cdecccd8e112
[...]
{
    "id": "echo",
    "value": "Hello My Name! Message"
}

or the second call should return

{
    "outputs":[
        {
            "id":"echo",
            "value":"Hello My Name! Message"
        }
    ]
}

Additional context

If response is not present, or response: "raw", then the result is always

{
    "id": "echo",
    "value": "Hello My Name! Message"
}