This works fine with the core swagger-jaxrs project.  You might need to file an 
issue on springfox (assuming you’re using that) to see what is wrong with your 
setup.

> On Jan 30, 2017, at 3:48 AM, antxa <arantza.ot...@ehu.eus> wrote:
> 
> Hi all,
> I've implemented a REST API in Java and one of the POST request accepts a 
> file sent in the body. Everything works OK if I call using this curl:
>  curl -F "doc=@file.txt" localhost:8080/index
> 
> 
> 
> The problem is that I want to use Swagger for the documentation, and I'm not 
> able to get the same curl through swagger-ui.
> This is my snippet code:
> 
> @ApiOperation(value = "Index a single document", notes = "...", response = 
> ResultIndex.class)
>     @RequestMapping(value = "/index", method = RequestMethod.POST, consumes={ 
> MediaType.MULTIPART_FORM_DATA_VALUE }, produces = "application/json")
>         @ApiImplicitParams({
>  @ApiImplicitParam(name = "doc", value = "...", required = true, dataType = 
> "file", paramType = "form")})
>  public ResultIndex index(@RequestPart(value="doc", required=true) 
> MultipartFile doc)
> 
> And this produces the following curl on the swagger-ui:
> 
> curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: 
> application/json' {"type":"formData"} 'http://localhost:8080/index'
> 
> What's wrong in my code?
> 
> Thanks!
> 
> -- 
> 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-swaggersocket+unsubscr...@googlegroups.com 
> <mailto:swagger-swaggersocket+unsubscr...@googlegroups.com>.
> 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 swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to