You can do this, but the swagger-ui won’t know how to render it.  If you read 
the spec, the only supported UI upload is with multi-part form data

> On Nov 8, 2016, at 11:43 AM, Fabio Maulo <[email protected]> wrote:
> 
> Hi all.
> I have tried different combination of parameter types but I can't achieve to 
> document the real method behavior.
> The POST needs two required custom headers ("docs-tenant" and "docs-meta") 
> and the entirely body-content is just a file (jpg,pdf,xml, whatever); the 
> content-type of the request should be the MIME-type of the request content.
> 
> The follow is my "last-try" 
>       "post": {
>         "tags": [
>           "Documents"
>         ],
>         "operationId": "Create",
>         "consumes": [
>           "multipart/form-data"
>         ],
>         "produces": [
>           "application/json",
>           "text/json",
>           "application/xml",
>           "text/xml"
>         ],
>         "parameters": [
>           {
>             "name": "docs-tenant",
>             "in": "header",
>             "required": true,
>             "type": "string"
>           },
>           {
>             "name": "docs-meta",
>             "in": "header",
>             "required": true,
>             "type": "string"
>           },
>           {
>             "name": "document",
>             "in": "body",
>             "required": true,
>             "schema": {
>               "type": "file"
>             }
>           }
>         ],
>         "responses": {
>           "200": {
>             "description": "OK",
>             "schema": {
>               "$ref": "#/definitions/DocumentMetadata"
>             }
>           },
>           "201": {
>             "description": "Created"
>           },
>           "400": {
>             "description": "BadRequest"
>           },
>           "409": {
>             "description": "Conflict"
>           }
>         },
>         "deprecated": false
>       }
> 
> Is there a way to document the behavior I'm having in the API ?
> Is there a way to document something closer without incur in a schema 
> validation error ?
> 
> Thanks in advance.
> --
> Fabio
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to