Skip to content

add support for multiple request body types #42

Open

Description

@mnahkies

It's possible to declare different request bodies for different content types.

Currently we simply use the first one that we find:

// todo support multiple request body types
for (const [requestBodyContentType, definition] of Object.entries(requestBody.content)) {
return {
requestBodyContentType,
requestBodyParameter: {
name: "requestBody",
description: requestBody.description,
in: "body",
required: requestBody.required,
schema: definition.schema,
allowEmptyValue: false,
deprecated: false,
},
}
}

At a minimum we should support:

  • multipart/form-data
  • application/octet-stream
  • text/plain

Ideally we'd additionally support XML, but that might be left for it's own issue.

Activity

  1. paztis commented on Nov 5, 2026

    @paztis

    any news about this ?

  2. mnahkies commented on Nov 6, 2026

    @mnahkies
    OwnerAuthor

    Some progress has been made, primarily around supporting more than just JSON (eg: https://github.com/mnahkies/openapi-code-generator/blob/main/packages%2Fopenapi-code-generator%2Fsrc%2Ftypescript%2Fcommon%2Ftypescript-common.ts#L160-L186)

    I've been on a bit of a hiatus whilst I work on other projects, but planning to renew focus on this one over the next few weeks.

    If you have specific requirements that would be useful input into prioritization. Eg: are you looking for multi-part form data, content negotiation, or something else?

  3. paztis commented on Nov 6, 2026

    @paztis

    Yes. Il have few entrypoints in my openai contract dedicated for document upload.
    Because of the size of the documents, multiparty/form-data is the best choice.

    I'm forced to develop an independent koa router to manage it
    Same at client side, I must wrap the client api with a FormData I cast back

  4. mnahkies commented on Nov 6, 2026

    @mnahkies
    OwnerAuthor

    Makes sense - yeah multi-part is basically next up on the list, it's a use case I have as well, I'd expect to get to this in the next month.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions