Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error response not complying with api specification #435

Open
hardbyte opened this issue Sep 25, 2019 · 1 comment
Open

error response not complying with api specification #435

hardbyte opened this issue Sep 25, 2019 · 1 comment

Comments

@hardbyte
Copy link
Collaborator

The json returned from the run status endpoint (and probably other endpoints) on json validation error isn't conforming to our json schema specification

Example error:

{
'detail': "2.0 is greater than the maximum of 1.0\n\nFailed validating 'maximum' in schema['properties']['current_stage']['properties']['progress']['properties']['relative']:\n {'description': 'Decimal between 0.0 and 1.0 indicating the relative '\n 'progress of this stage.\\n',\n 'format': 'double',\n 'maximum': 1.0,\n 'minimum': 0.0,\n 'type': 'number'}\n\nOn instance['current_stage']['progress']['relative']:\n 2.0",
 'status': 500, 
'title': 'Response body does not conform to specification', 
'type': 'about:blank'}

The spec is:

{
  "type": "http://anonlink.readthedocs.io/en/latest/problems.html#ratelimited",
  "title": "string",
  "status": 503,
  "detail": "Connection to database timed out",
  "instance": "http://example.com"
}
@wilko77
Copy link
Collaborator

wilko77 commented Sep 25, 2019

The spec is this:

  Problem:
    type: object
    properties:
      type:
        type: string
        format: uri
        description: |
          An absolute URI that identifies the problem type.  When dereferenced,
          it SHOULD provide human-readable documentation for the problem type
          (e.g., using HTML).
        default: 'about:blank'
        example: 'http://anonlink.readthedocs.io/en/latest/problems.html#ratelimited'
      title:
        type: string
        description: |
          A short, summary of the problem type. Written in english and readable
          for engineers; example: Service Unavailable
      status:
        type: integer
        format: int32
        description: |
          The HTTP status code generated by the origin server for this occurrence
          of the problem.
        minimum: 100
        maximum: 600
        exclusiveMaximum: true
        example: 503
      detail:
        type: string
        description: |
          A human readable explanation specific to this occurrence of the
          problem.
        example: Connection to database timed out
      instance:
        type: string
        format: uri
        description: |
          An absolute URI that identifies the specific occurrence of the problem.
          It may or may not yield further information if dereferenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants