diff --git a/modules/swagger-codegen/src/main/resources/retrofit/api.mustache b/modules/swagger-codegen/src/main/resources/retrofit/api.mustache index a916f363ff5..1f49b4a7cba 100644 --- a/modules/swagger-codegen/src/main/resources/retrofit/api.mustache +++ b/modules/swagger-codegen/src/main/resources/retrofit/api.mustache @@ -22,7 +22,7 @@ public interface {{classname}} { {{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} @{{httpMethod}}("{{path}}") {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}} {{nickname}}({{^allParams}});{{/allParams}} - {{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{^hasMore}} + {{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} );{{/hasMore}}{{/allParams}} {{/operation}} } diff --git a/modules/swagger-codegen/src/main/resources/retrofit/formParams.mustache b/modules/swagger-codegen/src/main/resources/retrofit/formParams.mustache index 9853bc0bf11..be9a3ca9b26 100644 --- a/modules/swagger-codegen/src/main/resources/retrofit/formParams.mustache +++ b/modules/swagger-codegen/src/main/resources/retrofit/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{#notFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{paramName}}") TypedFile {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{#notFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") TypedFile {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/PetApi.java index 90611a5cbac..cca8370a181 100644 --- a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/PetApi.java @@ -10,108 +10,108 @@ import io.swagger.client.model.Pet; import java.io.File; public interface PetApi { - + /** * Update an existing pet - * + * * @param body Pet object that needs to be added to the store * @return Void */ - - @PUT("/pet") + + @PUT("/pet") Void updatePet( @Body Pet body - ); - + ); + /** * Add a new pet to the store - * + * * @param body Pet object that needs to be added to the store * @return Void */ - - @POST("/pet") + + @POST("/pet") Void addPet( @Body Pet body - ); - + ); + /** * Finds Pets by status * Multiple status values can be provided with comma seperated strings * @param status Status values that need to be considered for filter * @return List */ - - @GET("/pet/findByStatus") + + @GET("/pet/findByStatus") List findPetsByStatus( @Query("status") List status - ); - + ); + /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return List */ - - @GET("/pet/findByTags") + + @GET("/pet/findByTags") List findPetsByTags( @Query("tags") List tags - ); - + ); + /** * Find pet by ID * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions * @param petId ID of pet that needs to be fetched * @return Pet */ - - @GET("/pet/{petId}") + + @GET("/pet/{petId}") Pet getPetById( @Path("petId") Long petId - ); - + ); + /** * Updates a pet in the store with form data - * + * * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet * @return Void */ - + @FormUrlEncoded - @POST("/pet/{petId}") + @POST("/pet/{petId}") Void updatePetWithForm( - @Path("petId") String petId,@Field("name") String name,@Field("status") String status - ); - + @Path("petId") String petId, @Field("name") String name, @Field("status") String status + ); + /** * Deletes a pet - * + * * @param petId Pet id to delete - * @param apiKey + * @param apiKey * @return Void */ - - @DELETE("/pet/{petId}") + + @DELETE("/pet/{petId}") Void deletePet( - @Path("petId") Long petId,@Header("api_key") String apiKey - ); - + @Path("petId") Long petId, @Header("api_key") String apiKey + ); + /** * uploads an image - * + * * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload * @return Void */ - + @Multipart - @POST("/pet/{petId}/uploadImage") + @POST("/pet/{petId}/uploadImage") Void uploadFile( - @Path("petId") Long petId,@Part("additionalMetadata") String additionalMetadata,@Part("file") TypedFile file - ); - + @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file") TypedFile file + ); + } diff --git a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/UserApi.java index 4aa39c52e2c..b80f9e5fa20 100644 --- a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/api/UserApi.java @@ -57,7 +57,7 @@ public interface UserApi { @GET("/user/login") String loginUser( - @Query("username") String username,@Query("password") String password + @Query("username") String username, @Query("password") String password ); /** @@ -92,7 +92,7 @@ public interface UserApi { @PUT("/user/{username}") Void updateUser( - @Path("username") String username,@Body User body + @Path("username") String username, @Body User body ); /** diff --git a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/model/Pet.java index f74264708e3..7d1368a74e0 100644 --- a/samples/client/petstore/retrofit/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/retrofit/src/main/java/io/swagger/client/model/Pet.java @@ -1,8 +1,8 @@ package io.swagger.client.model; import io.swagger.client.model.Category; -import java.util.*; import io.swagger.client.model.Tag; +import java.util.*; import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName;