Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

define application/json and type file to multipart request #704

Open
dinegri opened this issue Apr 10, 2019 · 3 comments
Open

define application/json and type file to multipart request #704

dinegri opened this issue Apr 10, 2019 · 3 comments

Comments

@dinegri
Copy link

dinegri commented Apr 10, 2019

Hi,

I tried to modelling a multipart request using a part as application/json and another part as a file without success.

I am wondering if raml allows you to describe a multipart request like in OpenAPI 3 (https://swagger.io/docs/specification/describing-request-body/multipart-requests/)

Reading Multipart RFC, it allow you to define Content-Type for the parts, so I guess that would be possible using raml

Thanks

@jstoiko
Copy link
Contributor

jstoiko commented Jun 3, 2019

Have you seen this blog post about modeling multipart requests? Does it address your question and if not, can you share an example (even an invalid one) of what you're trying to achieve?

@dinegri
Copy link
Author

dinegri commented Jun 6, 2019

Yes, I have seen. Well I understood that raml 1.0 does not support at least yet something like that openapi/multipart

@jstoiko
Copy link
Contributor

jstoiko commented Sep 26, 2019

Another option is to use a union type to define both the fileType and its underlying JSON structure.

E.g.

#%RAML 1.0
title: My API

types:
  MyFile: 
    type: file
    fileTypes: ['application/json']
  MyFileContent:
    properties:
      foo: integer
      bar: 

/resource:
  post:
    body:
      multipart/form-data:
        properties:
          my_file:
            type: MyFile | MyFileContent

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

No branches or pull requests

2 participants