Git Product home page Git Product logo

Comments (5)

handrews avatar handrews commented on June 2, 2024 1

It's also worth noting that when uploading multiple files for a form field with multipart/form-data, RFC 7578 requires having multiple parts with the same name, which can't be modeled by the current "treat it as a JSON object" approach.

from openapi-specification.

jeremyfiel avatar jeremyfiel commented on June 2, 2024 1

A big missing piece from the multipart/mixed RFC is the ability to define the body parts in the same way form-data uses content-disposition header.

Because the RFC is so old, and was originally for email messaging, apparently they didn't have a need to identify the body parts and the form-data RFC didn't address the /mixed RFC when updates were made for the new header.

if we could depend on this same header, I think it would help quite a lot to define mixed bodies with OAS, with the same syntax as form-data and x-www-urlencoded bodies

from openapi-specification.

jeremyfiel avatar jeremyfiel commented on June 2, 2024

EDIT: guess I should have read your link.

Another multipart option missing is the ability to send multiple files in a single form field.

It should be a form-data payload with a nested multipart body with individual parts for each file. There is no way to define a nested multipart payload.

This is as far as I can get with it. But no way to define the nested body parts if I were to send multiple file types

requestBody:
  content:
    'multipart/form-data':
      schema:
       name:
         type: string
       file:
         type: string
         format: binary
      encoding:
        name:
          headers:
            content-disposition:
              schema:
                type: string
          contentType: 'application/json'
        file:
          headers:
            content-disposition:
              schema:
                type: string
          contentType: 'multipart/mixed'

from openapi-specification.

handrews avatar handrews commented on June 2, 2024

@jeremyfiel I know that multipart/mixed and similar MIME-derived formats explicitly allow nesting.

I noticed that the most recent multipart/form-data RFC, RFC 7578, deprecates the nesting in favor of multiple parts with the same name. According to the RFC's appendix, the nested approach wasn't known to be implemented but I assume you have an implementation that does it.

from openapi-specification.

jeremyfiel avatar jeremyfiel commented on June 2, 2024

@jeremyfiel I know that multipart/mixed and similar MIME-derived formats explicitly allow nesting.

I noticed that the most recent multipart/form-data RFC, RFC 7578, deprecates the nesting in favor of multiple parts with the same name. According to the RFC's appendix, the nested approach wasn't known to be implemented but I assume you have an implementation that does it.

I'm not entirely sure we have a nested implementation, but we do heavily use /mixed payloads because we like having JSON metadata along side a file representation.

from openapi-specification.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.