Hello,
I have a problem to define a resource multipart/form-data with swagger ui. I would like to define a resource with 2 parameters : a file and a json document
This is my resource definition :
/documents/claims:
post:
tags:
- documents
summary: '...'
description: ...
produces:
- application/json
consumes:
- multipart/form-data
parameters:
- in: formData
name: file
type: file
description: the file to upload
required: true
- in: formData
name: documentInformation
required: true
description: all information about the document
schema:
$ref: '#/definitions/DocumentInformation'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Response'
definitions:
Document:
type: object
properties:
index_date:
type: string
format: date-time
description: ...
external_reference:
type: string
description: ...
And I don't know why but the swagger gives me this error :
Details
Object
code: "ONE_OF_MISSING"
params: Array [0]
message: "Not a valid parameter definition"
path: Array [5]
inner: Array [2]
0: Object
code: "ONE_OF_MISSING"
params: Array [0]
message: "Data does not match any schemas from 'oneOf'"
path: Array [5]
inner: Array [2]
1: Object
code: "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
message: "Missing required property: $ref"
path: Array [5]
level: 900
type: "Swagger Error"
description: "Not a valid parameter definition"
If I remove the schema of the 2nd parameter documentInformation and I replace it by a simple type like string, the error disappears.
Could you help me please? How can I do to send a file and a json object with a multi-part resource?
Thank you in advance for your help.