Open YathendraPrasad opened 7 years ago
Using Swagger codegen maven plugin 2.2.2 version
@jencodingatwork , FYI
@jencodingatwork : You can probably change the header description if not relevant
Hi , can i have update on this please
@YathendraPrasad I would suggest you to try the latest master to see if the issue has already been addressed.
Description
A generated post method (JAX-RS code) which takes 2 query parameters of string type and 2 @FormDataParam one for InputStream and one for FormDataContentDisposition for file object. There is client code generated which takes 3 parameters , one File parameter object and two string datatype values. The flow goes like this , A call is made to the POST Rest call which inturn makes call to the generated API client and from there to 3 rd party service (In my case it is watson service). My doubt here is that the code is failing when i try to build with the below exception
class com.ibm.mfp.adapters.sample.api.VisualRecognitionApi cannot be applied to given types; required: java.lang.String,java.io.File,java.lang.String,java.lang.String found: java.lang.String,java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String,java.lang.String,javax.ws.rs.core.SecurityContext reason: actual and formal argument lists differ in length
Server code generated :
@POST @Path("/detect_faces") @Consumes({ "multipart/form-data" }) @Produces({ "application/json" }) @io.swagger.annotations.ApiOperation(value = "Detect faces in an image", notes = "", response = Faces.class, tags={ "VisualRecognition" })@io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "success", response = Faces.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Faces.class) }) @OAuthSecurity(enabled=false) public Response v3DetectFacesPost(@ApiParam(value = "API Key used to authenticate.")@QueryParam("api_key") String apiKey, @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail , @ApiParam(value = "")@FormDataParam("parameters") String parameters ,@ApiParam(value = "") @DefaultValue("2016-05-20") @QueryParam("version") String version ,@Context SecurityContext securityContext),throws NotFoundException, ServiceFactoryFinderException {
com.ibm.mfp.adapters.sample.ApiClient apiAuthInstance = new com.ibm.mfp.adapters.sample.ApiClient(); com.ibm.mfp.adapters.sample.api.VisualRecognitionApi apiInstance = new com.ibm.mfp.adapters.sample.api.VisualRecognitionApi(apiAuthInstance);
result = apiInstance.v3DetectFacesPost(apiKey,fileInputStream, fileDetail,parameters,version,securityContext);
Java Client code generated
public Faces v3DetectFacesPost(String apiKey, File file, String parameters, String version) throws ApiException {
ApiResponse<Faces> resp = v3DetectFacesPostWithHttpInfo(apiKey, file, parameters, version); return resp.getData(); }
is the client code generated correct ??
Swagger-codegen version
version of swagger-codegen : 2.2.2
Swagger declaration file content or url