box-openapi icon indicating copy to clipboard operation
box-openapi copied to clipboard

Missing invalid_request_parameters code in ClientError

Open mcantrell opened this issue 1 year ago • 0 comments

Description of the issue

The API can return errors with invalid ClientError json which contains an invalid code: invalid_request_parameters. This is not a member of the expected enum.

To create the erroneous error, you can use the Collaborations API with an invalid notify query param (uses 1 instead of true):

curl -s -X POST "https://api.box.com/2.0/collaborations?notify=1" \
     -H "authorization: Bearer ${ACCESS_TOKEN}" \
     -H "content-type: application/json" \
     -d @./scripts/payloads/collaborate-folder.json | jq
{
  "type": "error",
  "status": 400,
  "code": "invalid_request_parameters",
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Invalid input parameters in request",
  "request_id": "ffhfc9hpkud5li85"
}

This can cause issues de-serializing the response in some generated clients.

Current content

#/components/schemas/ClientError

"code": {
    "description": "A Box-specific error code",
    "example": "item_name_invalid",
    "type": "string",
    "enum": [
        "created",
        "accepted",
        "no_content",
        "redirect",
        "not_modified",
        "bad_request",
        "unauthorized",
        "forbidden",
        "not_found",
        "method_not_allowed",
        "conflict",
        "precondition_failed",
        "too_many_requests",
        "internal_server_error",
        "unavailable",
        "item_name_invalid",
        "insufficient_scope"
    ]
}

Expected content

#/components/schemas/ClientError

"code": {
    "description": "A Box-specific error code",
    "example": "item_name_invalid",
    "type": "string",
    "enum": [
        "created",
        "accepted",
        "no_content",
        "redirect",
        "not_modified",
        "bad_request",
        "unauthorized",
        "forbidden",
        "not_found",
        "method_not_allowed",
        "conflict",
        "precondition_failed",
        "too_many_requests",
        "internal_server_error",
        "unavailable",
        "item_name_invalid",
        "insufficient_scope",
       "invalid_request_parameters"
    ]
}

Link to the documentation page

No response

mcantrell avatar May 10 '24 15:05 mcantrell