Can we have more than one InputStream in the Swagger UI ?

420 views
Skip to first unread message

Sundar Saranathan

unread,
Jan 25, 2017, 5:04:49 PM1/25/17
to Swagger
Hi,
I have an API that needs two input files.  I was thinking of using
 @ApiParam(value = "data1", required=true,allowMultiple =true) InputStream inputStream1
 @ApiParam(value = "data2", required=true,allowMultiple =true) InputStream inputStream2

Inside the code, I read the contents of inputstream and convert that to a file .

However, I am getting errors when the app is initialized and also, the contents of the first InputStream is not passed to the API.  Only the contents in the second InputStream goes through..

 [ERROR   ] The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.xxx.test(java.io.InputStream,java.io.InputStream) throws org.json.JSONException at parameter at index 0
  SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.xxx.test(java.io.InputStream,java.io.InputStream) throws org.json.JSONException at parameter at index 1
  SEVERE: Method, public javax.ws.rs.core.Response com.xxx.test(java.io.InputStream,java.io.InputStream) throws org.json.JSONException, annotated with POST of resource, class com.xxx.test, is not recognized as valid resource method.
[ERROR   ] SRVE0271E: Uncaught init() exception created by servlet [Jersey Web Application] in application [RestTEst]: com.sun.jersey.spi.inject.Errors$ErrorMessagesException
    at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)

Is this supported ?

Thanks in Advance,

Sundar.

tony tam

unread,
Jan 25, 2017, 5:08:32 PM1/25/17
to swagger-sw...@googlegroups.com
Hi Sundar, I think there are two issues.

First off, only one File is supported per operation in the 2.0 specification.  I understand that’s an annoying limitation but it is the spec, and you cannot expect tooling to support multiple files in one operation.

Next, that error message is very, very hard to track down.  Take a look at this example for how to do it properly:



--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

frazierj...@yahoo.com

unread,
Jan 25, 2017, 5:24:33 PM1/25/17
to swagger-sw...@googlegroups.com

--------------------------------------------
On Thu, 1/26/17, tony tam <feh...@gmail.com> wrote:

Subject: Re: Can we have more than one InputStream in the Swagger UI ?
To: swagger-sw...@googlegroups.com
Date: Thursday, January 26, 2017, 12:08 AM
a principiu s-a admis ca in toate actiunile ce vor avea loc in statele din Balcani Uniunea Sovietica sa nu participe oficial Ajutorul efectiv cu oameni si mijloace materiale este dat numai de catre comunistii grupati in centre care-si iau asupra-si responsabilitatea pentru ei

Ron Ratovsky

unread,
Jan 25, 2017, 5:58:00 PM1/25/17
to swagger-sw...@googlegroups.com

The spec doesn’t support uploading arbitrary number of files, but you can upload several files if you define each one of the explicitly.

 

 

From: <swagger-sw...@googlegroups.com> on behalf of tony tam <feh...@gmail.com>
Reply-To: "swagger-sw...@googlegroups.com" <swagger-sw...@googlegroups.com>
Date: Wednesday, 25 January 2017 at 14:08
To: "swagger-sw...@googlegroups.com" <swagger-sw...@googlegroups.com>
Subject: Re: Can we have more than one InputStream in the Swagger UI ?

 

Hi Sundar, I think there are two issues.

Reply all
Reply to author
Forward
0 new messages