forked from loafle/openapi-generator-original
Retrofit: fix form field naming by using baseName
This commit is contained in:
parent
e879268043
commit
a134b5ca76
@ -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}}
|
||||
}
|
||||
|
@ -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}}
|
||||
{{#isFormParam}}{{#notFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") TypedFile {{paramName}}{{/isFile}}{{/isFormParam}}
|
@ -83,20 +83,20 @@ public interface PetApi {
|
||||
@FormUrlEncoded
|
||||
@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 apiKey
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
* @return Void
|
||||
*/
|
||||
|
||||
@DELETE("/pet/{petId}")
|
||||
Void deletePet(
|
||||
@Header("api_key") String apiKey,@Path("petId") Long petId
|
||||
@Path("petId") Long petId, @Header("api_key") String apiKey
|
||||
);
|
||||
|
||||
/**
|
||||
@ -111,7 +111,7 @@ public interface PetApi {
|
||||
@Multipart
|
||||
@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
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -120,7 +120,7 @@ public class PetApiTest {
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
api.deletePet(null, fetched.getId());
|
||||
api.deletePet(fetched.getId(), null);
|
||||
|
||||
try {
|
||||
fetched = api.getPetById(fetched.getId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user