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

Incorrect typing of 429 responses #24

Open
danny-may opened this issue Aug 30, 2023 · 1 comment
Open

Incorrect typing of 429 responses #24

danny-may opened this issue Aug 30, 2023 · 1 comment

Comments

@danny-may
Copy link

danny-may commented Aug 30, 2023

All(?) endpoints are subject to ratelimiting, and so are able to return 429 responses. when a 429 response is sent, the json body of the response doesnt match the schema declared by the 4XX status in the current spec - the errors property will never be returned, and the global and retry_after properties are missing from the spec. The client generator im working on at the moment has to shim these definitions into the spec currently using the below structure.

On a related note, the ratelimit headers, which each endpoint returns, are also missing from the spec.

docs

{
  "paths": {
    "/blah": {
      "get|post|put|...": {
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimitResponse"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RateLimitError": {
        "type": "object",
        "description": "An error returned when you are rate limited",
        "properties": {
          "code": {
            "type": "integer",
            "description": "An error code for some limits"
          },
          "message": {
            "type": "string",
            "description": "A message saying you are being rate limited"
          },
          "retry_after": {
            "type": "number",
            "description": "The number of seconds to wait before submitting another request"
          },
          "global": {
            "type": "boolean",
            "description": "A value indicating if you are being globally rate limited or not"
          }
        },
        "required": [
          "message",
          "retry_after",
          "global"
        ]
      }
    },
    "responses": {
      "RateLimitResponse": {
        "description": "Rate limit error response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RateLimitError"
            }
          }
        }
      }
    }
  }
}
@yonilerner
Copy link
Member

Thanks for reporting this

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

No branches or pull requests

3 participants