-
-
Notifications
You must be signed in to change notification settings - Fork 314
Description
Description
Currently, whenever there is an error with an OAProc-related request, pygeoapi responds with an exception with a schema like this:
type: object
required:
- code
properties:
code:
type: string
description:
type: stringThis is the schema used by the API.get_exception() method:
Line 4027 in 6981d3b
| def get_exception(self, status, headers, format_, code, |
This schema matches what is described in OGC API - Features, section 9.3 Exceptions.
Unfortunately, for OAProc, the standard describes a different schema for exceptions:
title: Exception Schema
description: JSON schema for exceptions based on RFC 7807
type: object
required:
- type
properties:
type:
type: string
title:
type: string
status:
type: integer
detail:
type: string
instance:
type: string
additionalProperties: trueThis means that pygeoapi is using an incorrect schema for formatting OAProc-related exceptions.
Additionally, since OAProc's exception.yaml file mentions in its description property that the exception is based on RFC 7807, I'm thinking the response's media type should be application/problem+json instead of application/json. I could not find any explicit mention of this media type in the OAProc document, so maybe I am wrong with this one - or it could be a gray area.
Steps to Reproduce
Stand up a local pygeapi instance and make an invalid request to a process-related endpoint. For example:
curl localhost:5000/processes/invalid-processpygeoapi responds with:
{
"code": "NoSuchProcess",
"description": "Identifier not found"
}Expected behavior
Given the aforementioned example, my expectation would be a response with a body that matches the schema of OAProc standard - for example something like:
{
"type": "http://www.opengis.net/def/exceptions/ogcapi-processes-1/1.0/no-such-process"
}