Skip to content

OGC API - Processes - Exception schema different from description in current version of the standard  #1316

@ricardogsilva

Description

@ricardogsilva

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: string

This is the schema used by the API.get_exception() method:

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: true

This 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-process

pygeoapi 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"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssue marked stale by stale-bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions