Foundry376 / express-zod-openapi-autogen

MIT License
11 stars 4 forks source link

Feature Request: Support setting "content" property on request body #4

Open tecfu opened 2 months ago

tecfu commented 2 months ago

Hello. I would like to be able to customize the content field in a requestBody in my Open API definition. Let's say I want to update the body to use multipart/form-date, for example:

"requestBody": {
  "required": true,
  "content": {
    "multipart/form-data": {
      "schema": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "FEATURE",
            "enum": [
              "FEATURE",
              "BUG"
            ]
          },
          "upload": {
            "type": "string",
            "format": "binary",
            "description": "The file being uploaded"
          }
        },
        "required": [
          "type",
          "upload"
        ]
      }
    }
  }
},

Please advise if a configuration exists for this. Thanks!

bengotow commented 2 months ago

It does not currently, I was thinking that #3 would support it but it looks like we need to update the zod-to-openapi dep past 2.0 (https://github.com/asteasolutions/zod-to-openapi/releases/tag/v2.0.0) for that per their release notes, will see if it's straightforward 👀