next-rest-framework icon indicating copy to clipboard operation
next-rest-framework copied to clipboard

Missing 400 response body structure

Open markedwards opened this issue 9 months ago • 0 comments

The generated OpenAPI spec describes 400 error responses as having this structure:

{
  "type": "object",
  "properties": { "message": { "type": "string" } },
  "required": ["message"],
  "additionalProperties": false
}

They actually include error output from zod:

{
  "message": "Invalid request body.",
  "errors": [
    {
      "code": "invalid_string",
      "validation": "datetime",
      "message": "Invalid datetime",
      "path": [
        "foo"
      ]
    }
  ]
}

Ideally the OpenAPI spec should include this so generated clients can access the errors.

markedwards avatar May 21 '24 13:05 markedwards