You cannot use type “file” in any location other than as a multipart/form-data input.
> On Nov 29, 2016, at 6:03 AM, Fabio Maulo <[email protected]> wrote: > > Unfortunately the problem is not SwaggerUI. > My swagger JSON is not valid when I use a swagger validator as > http://editor.swagger.io/ <http://editor.swagger.io/> > This is the error: > Swagger Error > Not a valid parameter definition > Jump to line 214 > <>Details > Object <> > code: "ONE_OF_MISSING" <> > params: Array [0] <> > message: "Not a valid parameter definition" <> > path: Array [5] <> > schemaId: "http://swagger.io/v2/schema.json#" <> > inner: Array [2] <> > 0: Object <> > code: "ONE_OF_MISSING" <> > params: Array [0] <> > message: "Data does not match any schemas from 'oneOf'" <> > path: Array [5] <> > 0: "paths" <> > 1: "/api/documents" <> > 2: "post" <> > 3: "parameters" <> > 4: "2" <> > inner: Array [2] <> > 1: Object <> > code: "OBJECT_MISSING_REQUIRED_PROPERTY" <> > params: Array [1] <> > message: "Missing required property: $ref" <> > path: Array [5] <> > 0: "paths" <> > 1: "/api/documents" <> > 2: "post" <> > 3: "parameters" <> > 4: "2" <> > level: 900 <> > type: "Swagger Error" <> > description: "Not a valid parameter definition" <> > lineNumber: 214 <> > > > Is there a way to document something closer without incur in a schema > validation error ? > > Thanks. > > On Mon, Nov 28, 2016 at 6:37 PM, tony tam <[email protected] > <mailto:[email protected]>> wrote: > 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] >> <mailto:[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 a topic in the Google > Groups "Swagger" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/swagger-swaggersocket/_UM_CkjVr_Y/unsubscribe > > <https://groups.google.com/d/topic/swagger-swaggersocket/_UM_CkjVr_Y/unsubscribe>. > To unsubscribe from this group and all its topics, 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>. > > > > -- > -- > Fabio Maulo > T @fabiomaulo > > -- > 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.
