{"action":"opened","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1851","repository_url":"https://api.github.com/repos/swagger-api/swagger-core","labels_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1851/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1851/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-core/issues/1851/events","html_url":"https://github.com/swagger-api/swagger-core/issues/1851","id":165253675,"number":1851,"title":"Uploading files with RestEasy - wrong parameter deffinition","user":{"login":"Romanow88","id":1837175,"avatar_url":"https://avatars.githubusercontent.com/u/1837175?v=3","gravatar_id":"","url":"https://api.github.com/users/Romanow88","html_url":"https://github.com/Romanow88","followers_url":"https://api.github.com/users/Romanow88/followers","following_url":"https://api.github.com/users/Romanow88/following{/other_user}","gists_url":"https://api.github.com/users/Romanow88/gists{/gist_id}","starred_url":"https://api.github.com/users/Romanow88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Romanow88/subscriptions","organizations_url":"https://api.github.com/users/Romanow88/orgs","repos_url":"https://api.github.com/users/Romanow88/repos","events_url":"https://api.github.com/users/Romanow88/events{/privacy}","received_events_url":"https://api.github.com/users/Romanow88/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-13T07:20:56Z","updated_at":"2016-07-13T07:20:56Z","closed_at":null,"body":"When using RestEasy for file uploads the defined way is to have a org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput as a parameter that will contain all of the files uploaded. Yet Swagger does not resolve this to the file type as it should, instead it generates the schema based on the inner properties of the MultipartFormDataInput . \r\n\r\nExample definition:\r\n \r\n` public Response uploadFile(MultipartFormDataInput input, @Context HttpServletRequest req)\r\n{\r\n      final Map<String, List<InputPart>> formDataMap = input.getFormDataMap();\r\n      final byte[] bytes = formDataMap.get(\"file\").get(0).getBody(byte[].class, null);\r\n      final String fileName = formDataMap.get(\"filename\").get(0).getBodyAsString();\r\n      return Response.ok().build();\r\n}\r\n`\r\n\r\nAs a workaround I'm hiding the  MultipartFormDataInput  with the swagger hidden flag and using an implicit param annotation to generate the correct definition so that the Swagger UI actualy shown a file picker (which throws a java.lang.ClassNotFoundException: file on runtime)\r\n\r\n`  @ApiImplicitParams(\r\n      @ApiImplicitParam(dataType = \"file\", name = \"file\", value=\"File to be uploaded\", paramType = \"formData\")\r\n  )\r\n`\r\n\r\nIt would be awesome if swagger could except \"file\" as the dataType without exceptions and could understand the MultipartFormDataInput as a file upload for RestEasy."}}
{"actor":{"display_login":"Romanow88"}}