3
votes

In the RAML tutorial found on the official page (http://raml.org/developers/raml-200-tutorial#body-parameters), a definition for a file upload looks like follows:

/file-content:
  post:
  description: bla
  body:
    multipart/form-data:
      formParameters:
        file:
          description: The file to be uploaded
          required: true
          type: file

However, this seems only to work for RAML 0.8, but not 1.0. The "What's New" section of 1.0 also contains this text: "Uniformly covers bodies, URI parameters, headers, and query parameters and eliminates the need for a separate formParameters construct". (https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#whats-new-and-different-in-raml-10)

So it seems the whole thing has changed, but I can't find an example about this, and I don't understand how I can migrate the example for fileupload to a working 1.0 example. Any ideas?

2

2 Answers

3
votes

Figured this out myself:

body:
  multipart/form-data:
    description: The file to be uploaded.
    required: true
    type: file
    example: !include someFile
2
votes

This how I did it. Where "file" property would be the formDataParam name.
You can specify multiple files by adding more properties under it.

body:
      multipart/form-data:
        properties:
          file:
            description: The file to be uploaded. Supported Formats are gif, jpeg, jpg, png.
            required: true
            type: file
            example: !include example.jpg