asteasolutions / zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas
MIT License
788 stars 52 forks source link

Request body - Can you use multiple media types? #201

Closed duncanhunter closed 6 months ago

duncanhunter commented 6 months ago

Is it possible to use multiple media types like below example? Each media type works on their own but not if both listed and returns a 400 before passing any validation "Invalid HTTP header: Content-Type=application/x-www-form-urlencoded" if I send form data. I am using hono.

  request: {
    body: {
      content: {
        "application/json": {
          schema: schema1
        },
        "application/x-www-form-urlencoded": {
          schema: schema1
        }
      }
    }
  }
AGalabov commented 6 months ago

Hello @duncanhunter. Saddly this is not the place to ask - our library is handling only the OpenAPI document generation part. And on that part - we do support multiple media types.

Hono are using our library on their end to generate a documentation. But the status codes and anything runtime is handled on their end. Please bring this up to them. I'll be closing this issue now as there is nothing we can do to help out.