Following the swagger specs, I am trying to load a data file.
- parameters
- name: file
in: formData
description: data file
required: true
type: file
consumes:
- multipart/form-data
The a127 swagger editor is rejecting "type: file" with error:
Data does not match any schemas from "oneOf" at paths ▹ /orgs/{orgID]/data/{fileName} ▹ post ▹ parameters ▹ 2
What is the correct way to spec a file transfer?
Answer by Jeremy Whitlock · Oct 14, 2014 at 04:57 PM
This has been resolved. I didn't realize the Swagger schema was being updated in a different repository and swagger-tools didn't reflect the latest schema. I've fixed this, pushed to Bower and NPM. [swagger-tools@0.6.1](https://www.npmjs.org/package/swagger-tools)
swagger-tools has been fixed but that does not mean a127 is updated to use the new version. I'll let Scott comment on that.
Answer by Hung Vo · Oct 13, 2014 at 11:35 PM
'consumes' is at the same level as 'parameters', it is not a child of 'parameters'. i also have tried at the global level. is 'file' a valid 'type' value? i am struggling with how to define a file transfer. do you know of a good example on how to define this?
Answer by Jeremy Whitlock · Oct 14, 2014 at 02:52 AM
I'm not sure if this helps but it seems `file` is handled differently: https://github.com/wordnik/swagger-spec/blob/master/versions/2.0.md