From e7340bfe5bb8f61a501d00975399488b6c32006b Mon Sep 17 00:00:00 2001 From: Victor Orlovsky Date: Thu, 16 Aug 2018 07:15:15 +0300 Subject: [PATCH 01/37] [Java][Rest-assured] Fix "invokerPackage" in ApiClient, remove unnecessary @Authorization (#822) --- .../libraries/rest-assured/ApiClient.mustache | 2 +- .../Java/libraries/rest-assured/api.mustache | 10 +-- .../client/api/AnotherFakeApi.java | 4 +- .../org/openapitools/client/api/FakeApi.java | 46 +++++++---- .../client/api/FakeClassnameTags123Api.java | 6 +- .../org/openapitools/client/api/PetApi.java | 78 +++++++------------ .../org/openapitools/client/api/StoreApi.java | 18 +++-- .../org/openapitools/client/api/UserApi.java | 32 ++++++-- 8 files changed, 106 insertions(+), 90 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/ApiClient.mustache index cf8d5c45ba2..42bdf68613b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/ApiClient.mustache @@ -13,7 +13,7 @@ import java.util.function.Supplier; import static io.restassured.config.ObjectMapperConfig.objectMapperConfig; import static io.restassured.config.RestAssuredConfig.config; -import static org.openapitools.client.GsonObjectMapper.gson; +import static {{invokerPackage}}.GsonObjectMapper.gson; {{/fullJavaUtil}} public class ApiClient { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache index 1f400d0efa1..f536ddf9b49 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache @@ -43,13 +43,9 @@ public class {{classname}} { {{#operations}} {{#operation}} - @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = { - {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { - {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, - {{/hasMore}}{{/scopes}} - }{{/isOAuth}}){{#hasMore}}, - {{/hasMore}}{{/authMethods}} - }{{/hasAuthMethods}}, tags={ {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) + @ApiOperation(value = "{{{summary}}}", + notes = "{{{notes}}}", + tags={ {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} }) {{#isDeprecated}} diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 58ab8015d06..9baed9be21d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -49,7 +49,9 @@ public class AnotherFakeApi { } - @ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", tags={ "$another-fake?" }) + @ApiOperation(value = "To test special tags", + notes = "To test special tags and operation ID starting with number", + tags={ "$another-fake?" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public Call123testSpecialTagsOper call123testSpecialTags() { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java index e39e207f36e..c5a3414f460 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java @@ -56,58 +56,72 @@ public class FakeApi { } - @ApiOperation(value = "", notes = "Test serialization of outer boolean types", tags={ "fake" }) + @ApiOperation(value = "", + notes = "Test serialization of outer boolean types", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output boolean") }) public FakeOuterBooleanSerializeOper fakeOuterBooleanSerialize() { return new FakeOuterBooleanSerializeOper(reqSpec); } - @ApiOperation(value = "", notes = "Test serialization of object with outer number type", tags={ "fake" }) + @ApiOperation(value = "", + notes = "Test serialization of object with outer number type", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output composite") }) public FakeOuterCompositeSerializeOper fakeOuterCompositeSerialize() { return new FakeOuterCompositeSerializeOper(reqSpec); } - @ApiOperation(value = "", notes = "Test serialization of outer number types", tags={ "fake" }) + @ApiOperation(value = "", + notes = "Test serialization of outer number types", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output number") }) public FakeOuterNumberSerializeOper fakeOuterNumberSerialize() { return new FakeOuterNumberSerializeOper(reqSpec); } - @ApiOperation(value = "", notes = "Test serialization of outer string types", tags={ "fake" }) + @ApiOperation(value = "", + notes = "Test serialization of outer string types", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Output string") }) public FakeOuterStringSerializeOper fakeOuterStringSerialize() { return new FakeOuterStringSerializeOper(reqSpec); } - @ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake" }) + @ApiOperation(value = "", + notes = "For this test, the body for this request much reference a schema named `File`.", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) public TestBodyWithFileSchemaOper testBodyWithFileSchema() { return new TestBodyWithFileSchemaOper(reqSpec); } - @ApiOperation(value = "", notes = "", tags={ "fake" }) + @ApiOperation(value = "", + notes = "", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) public TestBodyWithQueryParamsOper testBodyWithQueryParams() { return new TestBodyWithQueryParamsOper(reqSpec); } - @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", tags={ "fake" }) + @ApiOperation(value = "To test \"client\" model", + notes = "To test \"client\" model", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public TestClientModelOper testClientModel() { return new TestClientModelOper(reqSpec); } - @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = { - @Authorization(value = "http_basic_test") - }, tags={ "fake" }) + @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", + notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied") , @ApiResponse(code = 404, message = "User not found") }) @@ -115,7 +129,9 @@ public class FakeApi { return new TestEndpointParametersOper(reqSpec); } - @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", tags={ "fake" }) + @ApiOperation(value = "To test enum parameters", + notes = "To test enum parameters", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request") , @ApiResponse(code = 404, message = "Not found") }) @@ -123,14 +139,18 @@ public class FakeApi { return new TestEnumParametersOper(reqSpec); } - @ApiOperation(value = "test inline additionalProperties", notes = "", tags={ "fake" }) + @ApiOperation(value = "test inline additionalProperties", + notes = "", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public TestInlineAdditionalPropertiesOper testInlineAdditionalProperties() { return new TestInlineAdditionalPropertiesOper(reqSpec); } - @ApiOperation(value = "test json serialization of form data", notes = "", tags={ "fake" }) + @ApiOperation(value = "test json serialization of form data", + notes = "", + tags={ "fake" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public TestJsonFormDataOper testJsonFormData() { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index a68d2045748..459e77f08ed 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -49,9 +49,9 @@ public class FakeClassnameTags123Api { } - @ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", authorizations = { - @Authorization(value = "api_key_query") - }, tags={ "fake_classname_tags 123#$%^" }) + @ApiOperation(value = "To test class name in snake case", + notes = "To test class name in snake case", + tags={ "fake_classname_tags 123#$%^" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public TestClassnameOper testClassname() { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java index d99a9dbc1d3..f0ed89d9c3f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java @@ -51,36 +51,27 @@ public class PetApi { } - @ApiOperation(value = "Add a new pet to the store", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Add a new pet to the store", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) public AddPetOper addPet() { return new AddPetOper(reqSpec); } - @ApiOperation(value = "Deletes a pet", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Deletes a pet", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value") }) public DeletePetOper deletePet() { return new DeletePetOper(reqSpec); } - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Finds Pets by status", + notes = "Multiple status values can be provided with comma separated strings", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid status value") }) @@ -88,12 +79,9 @@ public class PetApi { return new FindPetsByStatusOper(reqSpec); } - @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Finds Pets by tags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid tag value") }) @@ -102,9 +90,9 @@ public class PetApi { return new FindPetsByTagsOper(reqSpec); } - @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", authorizations = { - @Authorization(value = "api_key") - }, tags={ "pet" }) + @ApiOperation(value = "Find pet by ID", + notes = "Returns a single pet", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid ID supplied") , @@ -113,12 +101,9 @@ public class PetApi { return new GetPetByIdOper(reqSpec); } - @ApiOperation(value = "Update an existing pet", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Update an existing pet", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied") , @ApiResponse(code = 404, message = "Pet not found") , @@ -127,36 +112,27 @@ public class PetApi { return new UpdatePetOper(reqSpec); } - @ApiOperation(value = "Updates a pet in the store with form data", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "Updates a pet in the store with form data", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) public UpdatePetWithFormOper updatePetWithForm() { return new UpdatePetWithFormOper(reqSpec); } - @ApiOperation(value = "uploads an image", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "uploads an image", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public UploadFileOper uploadFile() { return new UploadFileOper(reqSpec); } - @ApiOperation(value = "uploads an image (required)", notes = "", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }, tags={ "pet" }) + @ApiOperation(value = "uploads an image (required)", + notes = "", + tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public UploadFileWithRequiredFileOper uploadFileWithRequiredFile() { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java index a796a6776dc..03a4d5587f9 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java @@ -49,7 +49,9 @@ public class StoreApi { } - @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", tags={ "store" }) + @ApiOperation(value = "Delete purchase order by ID", + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + tags={ "store" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied") , @ApiResponse(code = 404, message = "Order not found") }) @@ -57,16 +59,18 @@ public class StoreApi { return new DeleteOrderOper(reqSpec); } - @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", authorizations = { - @Authorization(value = "api_key") - }, tags={ "store" }) + @ApiOperation(value = "Returns pet inventories by status", + notes = "Returns a map of status codes to quantities", + tags={ "store" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public GetInventoryOper getInventory() { return new GetInventoryOper(reqSpec); } - @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", tags={ "store" }) + @ApiOperation(value = "Find purchase order by ID", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + tags={ "store" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid ID supplied") , @@ -75,7 +79,9 @@ public class StoreApi { return new GetOrderByIdOper(reqSpec); } - @ApiOperation(value = "Place an order for a pet", notes = "", tags={ "store" }) + @ApiOperation(value = "Place an order for a pet", + notes = "", + tags={ "store" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid Order") }) diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java index 37c4bc747ea..de5aa794f07 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java @@ -49,28 +49,36 @@ public class UserApi { } - @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", tags={ "user" }) + @ApiOperation(value = "Create user", + notes = "This can only be done by the logged in user.", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 0, message = "successful operation") }) public CreateUserOper createUser() { return new CreateUserOper(reqSpec); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user" }) + @ApiOperation(value = "Creates list of users with given input array", + notes = "", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 0, message = "successful operation") }) public CreateUsersWithArrayInputOper createUsersWithArrayInput() { return new CreateUsersWithArrayInputOper(reqSpec); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user" }) + @ApiOperation(value = "Creates list of users with given input array", + notes = "", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 0, message = "successful operation") }) public CreateUsersWithListInputOper createUsersWithListInput() { return new CreateUsersWithListInputOper(reqSpec); } - @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", tags={ "user" }) + @ApiOperation(value = "Delete user", + notes = "This can only be done by the logged in user.", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied") , @ApiResponse(code = 404, message = "User not found") }) @@ -78,7 +86,9 @@ public class UserApi { return new DeleteUserOper(reqSpec); } - @ApiOperation(value = "Get user by user name", notes = "", tags={ "user" }) + @ApiOperation(value = "Get user by user name", + notes = "", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid username supplied") , @@ -87,7 +97,9 @@ public class UserApi { return new GetUserByNameOper(reqSpec); } - @ApiOperation(value = "Logs user into the system", notes = "", tags={ "user" }) + @ApiOperation(value = "Logs user into the system", + notes = "", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") , @ApiResponse(code = 400, message = "Invalid username/password supplied") }) @@ -95,14 +107,18 @@ public class UserApi { return new LoginUserOper(reqSpec); } - @ApiOperation(value = "Logs out current logged in user session", notes = "", tags={ "user" }) + @ApiOperation(value = "Logs out current logged in user session", + notes = "", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 0, message = "successful operation") }) public LogoutUserOper logoutUser() { return new LogoutUserOper(reqSpec); } - @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", tags={ "user" }) + @ApiOperation(value = "Updated user", + notes = "This can only be done by the logged in user.", + tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied") , @ApiResponse(code = 404, message = "User not found") }) From 5ffc297a69043a1fe655f88ba29e6cef97d2f74b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 16 Aug 2018 13:59:47 +0800 Subject: [PATCH 02/37] Fix Ruby script path in ensure-up-to-date (#823) * fix ruby script path in ensure-up-to-date * bin/ruby-client-petstore.sh --- bin/utils/ensure-up-to-date | 2 +- samples/client/petstore/ruby/.openapi-generator/VERSION | 2 +- samples/client/petstore/ruby/lib/petstore.rb | 2 +- .../client/petstore/ruby/lib/petstore/api/another_fake_api.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api/fake_api.rb | 2 +- .../ruby/lib/petstore/api/fake_classname_tags123_api.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api/pet_api.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api/store_api.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api/user_api.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api_client.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api_error.rb | 2 +- samples/client/petstore/ruby/lib/petstore/configuration.rb | 2 +- .../ruby/lib/petstore/models/additional_properties_class.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/animal.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb | 2 +- .../client/petstore/ruby/lib/petstore/models/api_response.rb | 2 +- .../ruby/lib/petstore/models/array_of_array_of_number_only.rb | 2 +- .../petstore/ruby/lib/petstore/models/array_of_number_only.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/array_test.rb | 2 +- .../client/petstore/ruby/lib/petstore/models/capitalization.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/cat.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/category.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/class_model.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/client.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/dog.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/enum_class.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/enum_test.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/file.rb | 2 +- .../petstore/ruby/lib/petstore/models/file_schema_test_class.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/format_test.rb | 2 +- .../petstore/ruby/lib/petstore/models/has_only_read_only.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/list.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/map_test.rb | 2 +- .../models/mixed_properties_and_additional_properties_class.rb | 2 +- .../petstore/ruby/lib/petstore/models/model200_response.rb | 2 +- .../client/petstore/ruby/lib/petstore/models/model_return.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/name.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/number_only.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/order.rb | 2 +- .../client/petstore/ruby/lib/petstore/models/outer_composite.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/pet.rb | 2 +- .../client/petstore/ruby/lib/petstore/models/read_only_first.rb | 2 +- .../petstore/ruby/lib/petstore/models/special_model_name.rb | 2 +- .../petstore/ruby/lib/petstore/models/string_boolean_map.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/tag.rb | 2 +- samples/client/petstore/ruby/lib/petstore/models/user.rb | 2 +- samples/client/petstore/ruby/lib/petstore/version.rb | 2 +- samples/client/petstore/ruby/petstore.gemspec | 2 +- samples/client/petstore/ruby/pom.xml | 2 +- 51 files changed, 51 insertions(+), 51 deletions(-) diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index d6b71925769..6e2fd3a1ec2 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -10,7 +10,7 @@ echo "Please press CTRL+C to stop or the script will continue in 5 seconds." sleep 5 # LIST OF SCRIPTS: -./bin/ruby-petstore.sh > /dev/null 2>&1 +./bin/ruby-client-petstore.sh > /dev/null 2>&1 ./bin/java-petstore-all.sh > /dev/null 2>&1 ./bin/java-jaxrs-petstore-server-all.sh > /dev/null 2>&1 ./bin/spring-all-pestore.sh > /dev/null 2>&1 diff --git a/samples/client/petstore/ruby/.openapi-generator/VERSION b/samples/client/petstore/ruby/.openapi-generator/VERSION index 14900cee60e..105bb87d77b 100644 --- a/samples/client/petstore/ruby/.openapi-generator/VERSION +++ b/samples/client/petstore/ruby/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index fb9522a24ca..598c2b3919f 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 631a32a42dc..a01464bcd66 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 73202e75325..472102183a3 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index 673879cf076..47cab553694 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index ba02b06905d..a27efeeece5 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 40e2658140f..c51d336f12a 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 9a51c874d24..255510895c8 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 06f714c0e77..f86f7ec6243 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/api_error.rb b/samples/client/petstore/ruby/lib/petstore/api_error.rb index 78edb8feb73..15ef3226efc 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_error.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_error.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 6f8132d700c..1e66a8559b9 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb index bea7565c37f..4c40c623b8f 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index f2dcfb278aa..579231b000a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb index 92776bda94f..e7811e4798c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal_farm.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb index 47613736d9e..8cd7a2711a3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb index 200b1003f33..136e431c551 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb index b50fbb4bd61..d35a51fd470 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb index af3061da626..294cd95c40c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb index fdabd812601..9a585f47bb1 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index 129be2ccbdf..96255af1ec9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index baccd2ecd07..9f83507146c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/class_model.rb b/samples/client/petstore/ruby/lib/petstore/models/class_model.rb index d5b7d848a9a..8938ecd9bc9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/class_model.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/client.rb b/samples/client/petstore/ruby/lib/petstore/models/client.rb index 61a4bc93f0c..126a53a805d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/client.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index 5628376f957..fb0156507f3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb index bed06c5194c..7393f8e4c35 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb index 46059c24614..b97dc53bcbd 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb index 40416289d45..cd44b964ad0 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/file.rb b/samples/client/petstore/ruby/lib/petstore/models/file.rb index e141d680f8f..e36ed338c54 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/file.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb b/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb index 4dd48acfa93..ef8c37782f2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index 9f04147e823..05c76551442 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb b/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb index 6b33d9e5504..5a9157fcb8d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/list.rb b/samples/client/petstore/ruby/lib/petstore/models/list.rb index a6d375a09b5..2ff1f47e36e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/list.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb index 40d6ce9a90d..53f109c6fef 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 9666d11d158..b9e0b4a1746 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb index 3bb679ae3c2..c3de5c78a63 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index 8de1e511d6e..e5f542d04ce 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index 990d4c67751..07b376baad5 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb index 60a525f0b5e..f4c9785e200 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index 2f2ec5e9145..379d8403ccd 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb index eaeeed40882..b5c930f6389 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb index d815de0d8f4..ceda7c306f7 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index ceb3d9d327f..f4e0886e93f 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb index 992bea8712e..2d2429d7fb3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index 13ab4f67fc9..40069972c20 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/string_boolean_map.rb b/samples/client/petstore/ruby/lib/petstore/models/string_boolean_map.rb index 2318f7e8fb0..097bd76679a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/string_boolean_map.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/string_boolean_map.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index 220c9848b73..4b32244860a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index ce1f13ae839..573c7e72457 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/lib/petstore/version.rb b/samples/client/petstore/ruby/lib/petstore/version.rb index 1f94471ed8c..da903464b15 100644 --- a/samples/client/petstore/ruby/lib/petstore/version.rb +++ b/samples/client/petstore/ruby/lib/petstore/version.rb @@ -6,7 +6,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/petstore.gemspec b/samples/client/petstore/ruby/petstore.gemspec index a7beed1589c..c958919d006 100644 --- a/samples/client/petstore/ruby/petstore.gemspec +++ b/samples/client/petstore/ruby/petstore.gemspec @@ -8,7 +8,7 @@ OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.1-SNAPSHOT +OpenAPI Generator version: 3.2.2-SNAPSHOT =end diff --git a/samples/client/petstore/ruby/pom.xml b/samples/client/petstore/ruby/pom.xml index f4c621fca53..7da992f4e86 100644 --- a/samples/client/petstore/ruby/pom.xml +++ b/samples/client/petstore/ruby/pom.xml @@ -4,7 +4,7 @@ RubyPetstoreClientTests pom 1.0-SNAPSHOT - Ruby Swagger Petstore Client + Ruby OpenAPI Petstore Client From 1c6ab3f831d517ce89fae2adc4cb7bab65c3a199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rytis=20Karpu=C5=A1ka?= Date: Thu, 16 Aug 2018 13:16:58 +0300 Subject: [PATCH 03/37] Add localVar prefix to parameterized functions variables in cpprestsdk in order to make name clashing less probable. (#731) --- .../cpp-rest-sdk-client/api-source.mustache | 214 +++--- .../petstore/cpp-restsdk/api/PetApi.cpp | 702 +++++++++--------- .../petstore/cpp-restsdk/api/StoreApi.cpp | 352 ++++----- .../petstore/cpp-restsdk/api/UserApi.cpp | 690 ++++++++--------- 4 files changed, 979 insertions(+), 979 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache index 81df5d1ff56..d00fcdeb6e3 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache @@ -36,55 +36,55 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r } {{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}} - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("{{{path}}}"); - {{#pathParams}}boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("{{baseName}}") + utility::conversions::to_string_t("}"), ApiClient::parameterToString({{{paramName}}})); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("{{{path}}}"); + {{#pathParams}}boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("{{baseName}}") + utility::conversions::to_string_t("}"), ApiClient::parameterToString({{{paramName}}})); {{/pathParams}} - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; {{#produces}} - responseHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") ); {{/produces}} - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { {{#vendorExtensions.x-codegen-response.isString}} - responseHttpContentType = utility::conversions::to_string_t("text/plain"); + localVarResponseHttpContentType = utility::conversions::to_string_t("text/plain"); {{/vendorExtensions.x-codegen-response.isString}} {{^vendorExtensions.x-codegen-response.isString}} - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); {{/vendorExtensions.x-codegen-response.isString}} } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } {{#vendorExtensions.x-codegen-response.isString}} // plain text - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("text/plain")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("text/plain")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("text/plain"); + localVarResponseHttpContentType = utility::conversions::to_string_t("text/plain"); } {{/vendorExtensions.x-codegen-response.isString}} {{#vendorExtensions.x-codegen-response-ishttpcontent}} else { //It's going to be binary, so just use the first one. - responseHttpContentType = *responseHttpContentTypes.begin(); + localVarResponseHttpContentType = *localVarResponseHttpContentTypes.begin(); } {{/vendorExtensions.x-codegen-response-ishttpcontent}} {{^vendorExtensions.x-codegen-response-ishttpcontent}} @@ -94,11 +94,11 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r } {{/vendorExtensions.x-codegen-response-ishttpcontent}} - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; {{#consumes}} - consumeHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") ); {{/consumes}} {{#allParams}} @@ -131,17 +131,17 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r {{/required}} { {{#isQueryParam}} - queryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); + localVarQueryParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); {{/isQueryParam}} {{#isHeaderParam}} - headerParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); + localVarHeaderParams[utility::conversions::to_string_t("{{baseName}}")] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); {{/isHeaderParam}} {{#isFormParam}} {{#isFile}} - fileParams[ utility::conversions::to_string_t("{{baseName}}") ] = {{^required}}*{{/required}}{{paramName}}; + localVarFileParams[ utility::conversions::to_string_t("{{baseName}}") ] = {{^required}}*{{/required}}{{paramName}}; {{/isFile}} {{^isFile}} - formParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); + localVarFormParams[ utility::conversions::to_string_t("{{baseName}}") ] = ApiClient::parameterToString({{^required}}*{{/required}}{{paramName}}); {{/isFile}} {{/isFormParam}} } @@ -149,77 +149,77 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r {{/isBodyParam}} {{/allParams}} - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); {{#bodyParam}} - web::json::value json; + web::json::value localVarJson; {{#isPrimitiveType}} - json = ModelBase::toJson({{paramName}}); + localVarJson = ModelBase::toJson({{paramName}}); {{/isPrimitiveType}} {{^isPrimitiveType}} {{#isListContainer}} { - std::vector jsonArray; - for( auto& item : {{paramName}} ) + std::vector localVarJsonArray; + for( auto& localVarItem : {{paramName}} ) { - {{#items.isPrimitiveType}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isPrimitiveType}}{{^items.isPrimitiveType}}{{#items.isString}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isDateTime}}{{^items.isDateTime}}jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + {{#items.isPrimitiveType}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isPrimitiveType}}{{^items.isPrimitiveType}}{{#items.isString}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isDateTime}}{{^items.isDateTime}}localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); {{/items.isDateTime}}{{/items.isString}}{{/items.isPrimitiveType}} } - json = web::json::value::array(jsonArray); + localVarJson = web::json::value::array(localVarJsonArray); } {{/isListContainer}} - {{^isListContainer}}{{#required}}json = ModelBase::toJson({{paramName}}); + {{^isListContainer}}{{#required}}localVarJson = ModelBase::toJson({{paramName}}); {{/required}}{{^required}}if ({{paramName}}) - json = ModelBase::toJson(*{{paramName}});{{/required}} + localVarJson = ModelBase::toJson(*{{paramName}});{{/required}} {{/isListContainer}} {{/isPrimitiveType}} - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); {{/bodyParam}} } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); {{#bodyParam}} - std::shared_ptr multipart(new MultipartFormData); + std::shared_ptr localVarMultipart(new MultipartFormData); {{#isPrimitiveType}} - multipart->add(ModelBase::toHttpContent("{{paramName}}", {{paramName}})); + localVarMultipart->add(ModelBase::toHttpContent("{{paramName}}", {{paramName}})); {{/isPrimitiveType}} {{^isPrimitiveType}} {{#isListContainer}} { - std::vector jsonArray; - for( auto& item : {{paramName}} ) + std::vector localVarJsonArray; + for( auto& localVarItem : {{paramName}} ) { - {{#items.isPrimitiveType}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isPrimitiveType}}{{^items.isPrimitiveType}}{{#items.isString}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}jsonArray.push_back(ModelBase::toJson(item)); - {{/items.isDateTime}}{{^items.isDateTime}}jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + {{#items.isPrimitiveType}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isPrimitiveType}}{{^items.isPrimitiveType}}{{#items.isString}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}localVarJsonArray.push_back(ModelBase::toJson(localVarItem)); + {{/items.isDateTime}}{{^items.isDateTime}}localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); {{/items.isDateTime}}{{/items.isString}}{{/items.isPrimitiveType}} } - multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("{{paramName}}"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json"))); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("{{paramName}}"), web::json::value::array(localVarJsonArray), utility::conversions::to_string_t("application/json"))); }{{/isListContainer}} - {{^isListContainer}}{{#isString}}multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("{{paramName}}"), {{paramName}})); + {{^isListContainer}}{{#isString}}localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("{{paramName}}"), {{paramName}})); {{/isString}}{{^isString}}if({{^required}}{{paramName}} && (*{{paramName}}){{/required}}{{#required}}{{paramName}}{{/required}}.get()) { - {{^required}}(*{{/required}}{{paramName}}{{^required}}){{/required}}->toMultipart(multipart, utility::conversions::to_string_t("{{paramName}}")); + {{^required}}(*{{/required}}{{paramName}}{{^required}}){{/required}}->toMultipart(localVarMultipart, utility::conversions::to_string_t("{{paramName}}")); } {{/isString}} {{/isListContainer}} {{/isPrimitiveType}} - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); {{/bodyParam}} } else @@ -232,19 +232,19 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r {{#isApiKey}} {{#isKeyInHeader}} { - utility::string_t apiKey = apiConfiguration->getApiKey(utility::conversions::to_string_t("{{keyParamName}}")); - if ( apiKey.size() > 0 ) + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("{{keyParamName}}")); + if ( localVarApiKey.size() > 0 ) { - headerParams[utility::conversions::to_string_t("{{keyParamName}}")] = apiKey; + localVarHeaderParams[utility::conversions::to_string_t("{{keyParamName}}")] = localVarApiKey; } } {{/isKeyInHeader}} {{#isKeyInQuery}} { - utility::string_t apiKey = apiConfiguration->getApiKey(utility::conversions::to_string_t("{{keyParamName}}")); - if ( apiKey.size() > 0 ) + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("{{keyParamName}}")); + if ( localVarApiKey.size() > 0 ) { - queryParams[utility::conversions::to_string_t("{{keyParamName}}")] = apiKey; + localVarQueryParams[utility::conversions::to_string_t("{{keyParamName}}")] = localVarApiKey; } } {{/isKeyInQuery}} @@ -257,91 +257,91 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r {{/isOAuth}} {{/authMethods}} - return m_ApiClient->callApi(path, utility::conversions::to_string_t("{{httpMethod}}"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("{{httpMethod}}"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling {{operationId}}: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling {{operationId}}: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling {{operationId}}: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling {{operationId}}: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } {{#vendorExtensions.x-codegen-response-ishttpcontent}} - return response.extract_vector(); + return localVarResponse.extract_vector(); }) - .then([=](std::vector response) + .then([=](std::vector localVarResponse) { - HttpContent result; - std::shared_ptr stream = std::make_shared(std::string(response.begin(), response.end())); - result.setData(stream); - return result; + HttpContent localVarResult; + std::shared_ptr stream = std::make_shared(std::string(localVarResponse.begin(), localVarResponse.end())); + localVarResult.setData(stream); + return localVarResult; {{/vendorExtensions.x-codegen-response-ishttpcontent}} {{^vendorExtensions.x-codegen-response-ishttpcontent}} - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { {{^returnType}} return void(); {{/returnType}} {{#returnType}} {{#returnContainer}} - {{{returnType}}} result; + {{{returnType}}} localVarResult; {{/returnContainer}} {{^returnContainer}} - {{{returnType}}} result({{{defaultResponse}}}); + {{{returnType}}} localVarResult({{{defaultResponse}}}); {{/returnContainer}} - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - {{#isListContainer}}for( auto& item : json.as_array() ) + {{#isListContainer}}for( auto& localVarItem : localVarJson.as_array() ) { - {{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}result.push_back(ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(item)); - {{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}result.push_back(ModelBase::stringFromJson(item)); - {{/vendorExtensions.x-codegen-response.items.isString}}{{^vendorExtensions.x-codegen-response.items.isString}}{{{vendorExtensions.x-codegen-response.items.datatype}}} itemObj({{{vendorExtensions.x-codegen-response.items.defaultValue}}}); - itemObj->fromJson(item); - result.push_back(itemObj); + {{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}localVarResult.push_back(ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(localVarItem)); + {{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}localVarResult.push_back(ModelBase::stringFromJson(localVarItem)); + {{/vendorExtensions.x-codegen-response.items.isString}}{{^vendorExtensions.x-codegen-response.items.isString}}{{{vendorExtensions.x-codegen-response.items.datatype}}} localVarItemObj({{{vendorExtensions.x-codegen-response.items.defaultValue}}}); + localVarItemObj->fromJson(localVarItem); + localVarResult.push_back(localVarItemObj); {{/vendorExtensions.x-codegen-response.items.isString}}{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}} } - {{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}for( auto& item : json.as_object() ) + {{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}for( auto& localVarItem : localVarJson.as_object() ) { - {{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}result[item.first] = ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(item.second); - {{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}result[item.first] = ModelBase::stringFromJson(item.second); - {{/vendorExtensions.x-codegen-response.items.isString}}{{^vendorExtensions.x-codegen-response.items.isString}}{{{vendorExtensions.x-codegen-response.items.datatype}}} itemObj({{{vendorExtensions.x-codegen-response.items.defaultValue}}}); - itemObj->fromJson(item.second); - result[item.first] = itemObj; + {{#vendorExtensions.x-codegen-response.items.isPrimitiveType}}localVarResult[localVarItem.first] = ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(localVarItem.second); + {{/vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.items.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.isString}}localVarResult[localVarItem.first] = ModelBase::stringFromJson(localVarItem.second); + {{/vendorExtensions.x-codegen-response.items.isString}}{{^vendorExtensions.x-codegen-response.items.isString}}{{{vendorExtensions.x-codegen-response.items.datatype}}} localVarItemObj({{{vendorExtensions.x-codegen-response.items.defaultValue}}}); + localVarItemObj->fromJson(localVarItem.second); + localVarResult[localVarItem.first] = localVarItemObj; {{/vendorExtensions.x-codegen-response.items.isString}}{{/vendorExtensions.x-codegen-response.items.isPrimitiveType}} } - {{/isMapContainer}}{{^isMapContainer}}{{#vendorExtensions.x-codegen-response.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.datatype}}result = ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(json); - {{/vendorExtensions.x-codegen-response.items.datatype}}{{^vendorExtensions.x-codegen-response.items.datatype}}result = ModelBase::{{vendorExtensions.x-codegen-response.datatype}}FromJson(json); - {{/vendorExtensions.x-codegen-response.items.datatype}}{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.isString}}result = ModelBase::stringFromJson(json); - {{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}result->fromJson(json);{{/vendorExtensions.x-codegen-response.isString}}{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{/isMapContainer}}{{/isListContainer}} + {{/isMapContainer}}{{^isMapContainer}}{{#vendorExtensions.x-codegen-response.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.items.datatype}}localVarResult = ModelBase::{{vendorExtensions.x-codegen-response.items.datatype}}FromJson(localVarJson); + {{/vendorExtensions.x-codegen-response.items.datatype}}{{^vendorExtensions.x-codegen-response.items.datatype}}localVarResult = ModelBase::{{vendorExtensions.x-codegen-response.datatype}}FromJson(localVarJson); + {{/vendorExtensions.x-codegen-response.items.datatype}}{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{^vendorExtensions.x-codegen-response.isPrimitiveType}}{{#vendorExtensions.x-codegen-response.isString}}localVarResult = ModelBase::stringFromJson(localVarJson); + {{/vendorExtensions.x-codegen-response.isString}}{{^vendorExtensions.x-codegen-response.isString}}localVarResult->fromJson(localVarJson);{{/vendorExtensions.x-codegen-response.isString}}{{/vendorExtensions.x-codegen-response.isPrimitiveType}}{{/isMapContainer}}{{/isListContainer}} }{{#vendorExtensions.x-codegen-response.isString}} - else if(responseHttpContentType == utility::conversions::to_string_t("text/plain")) + else if(localVarResponseHttpContentType == utility::conversions::to_string_t("text/plain")) { - result = response; + localVarResult = localVarResponse; }{{/vendorExtensions.x-codegen-response.isString}} - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -351,7 +351,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r , utility::conversions::to_string_t("error calling {{operationId}}: unsupported response type")); } - return result; + return localVarResult; {{/returnType}} {{/vendorExtensions.x-codegen-response-ishttpcontent}} }); diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/api/PetApi.cpp index c2f9a7f99f7..8d99e86ca8a 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/PetApi.cpp @@ -45,72 +45,72 @@ pplx::task PetApi::addPet(std::shared_ptr pet) } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->addPet does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; - consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; - json = ModelBase::toJson(pet); + localVarJson = ModelBase::toJson(pet); - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); if(pet.get()) { - pet->toMultipart(multipart, utility::conversions::to_string_t("pet")); + pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet")); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -120,36 +120,36 @@ pplx::task PetApi::addPet(std::shared_ptr pet) // authentication (petstore_auth) required // oauth2 authentication is added automatically as part of the http_client_config - return m_ApiClient->callApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling addPet: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling addPet: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling addPet: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling addPet: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -158,60 +158,60 @@ pplx::task PetApi::deletePet(int64_t petId, boost::optional apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/{petId}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/{petId}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->deletePet does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; if (apiKey) { - headerParams[utility::conversions::to_string_t("api_key")] = ApiClient::parameterToString(*apiKey); + localVarHeaderParams[utility::conversions::to_string_t("api_key")] = ApiClient::parameterToString(*apiKey); } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -221,36 +221,36 @@ pplx::task PetApi::deletePet(int64_t petId, boost::optionalcallApi(path, utility::conversions::to_string_t("DELETE"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling deletePet: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling deletePet: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling deletePet: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling deletePet: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -259,60 +259,60 @@ pplx::task>> PetApi::findPetsByStatus(std::vect { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/findByStatus"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/findByStatus"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->findPetsByStatus does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; { - queryParams[utility::conversions::to_string_t("status")] = ApiClient::parameterToString(status); + localVarQueryParams[utility::conversions::to_string_t("status")] = ApiClient::parameterToString(status); } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -322,53 +322,53 @@ pplx::task>> PetApi::findPetsByStatus(std::vect // authentication (petstore_auth) required // oauth2 authentication is added automatically as part of the http_client_config - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling findPetsByStatus: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling findPetsByStatus: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling findPetsByStatus: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling findPetsByStatus: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::vector> result; + std::vector> localVarResult; - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - for( auto& item : json.as_array() ) + for( auto& localVarItem : localVarJson.as_array() ) { - std::shared_ptr itemObj(new Pet()); - itemObj->fromJson(item); - result.push_back(itemObj); + std::shared_ptr localVarItemObj(new Pet()); + localVarItemObj->fromJson(localVarItem); + localVarResult.push_back(localVarItemObj); } } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -378,67 +378,67 @@ pplx::task>> PetApi::findPetsByStatus(std::vect , utility::conversions::to_string_t("error calling findPetsByStatus: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task>> PetApi::findPetsByTags(std::vector tags) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/findByTags"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/findByTags"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->findPetsByTags does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; { - queryParams[utility::conversions::to_string_t("tags")] = ApiClient::parameterToString(tags); + localVarQueryParams[utility::conversions::to_string_t("tags")] = ApiClient::parameterToString(tags); } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -448,53 +448,53 @@ pplx::task>> PetApi::findPetsByTags(std::vector // authentication (petstore_auth) required // oauth2 authentication is added automatically as part of the http_client_config - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling findPetsByTags: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling findPetsByTags: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling findPetsByTags: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling findPetsByTags: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::vector> result; + std::vector> localVarResult; - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - for( auto& item : json.as_array() ) + for( auto& localVarItem : localVarJson.as_array() ) { - std::shared_ptr itemObj(new Pet()); - itemObj->fromJson(item); - result.push_back(itemObj); + std::shared_ptr localVarItemObj(new Pet()); + localVarItemObj->fromJson(localVarItem); + localVarResult.push_back(localVarItemObj); } } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -504,65 +504,65 @@ pplx::task>> PetApi::findPetsByTags(std::vector , utility::conversions::to_string_t("error calling findPetsByTags: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task> PetApi::getPetById(int64_t petId) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/{petId}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/{petId}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->getPetById does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -571,53 +571,53 @@ pplx::task> PetApi::getPetById(int64_t petId) // authentication (api_key) required { - utility::string_t apiKey = apiConfiguration->getApiKey(utility::conversions::to_string_t("api_key")); - if ( apiKey.size() > 0 ) + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key")); + if ( localVarApiKey.size() > 0 ) { - headerParams[utility::conversions::to_string_t("api_key")] = apiKey; + localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey; } } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling getPetById: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling getPetById: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling getPetById: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling getPetById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::shared_ptr result(new Pet()); + std::shared_ptr localVarResult(new Pet()); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result->fromJson(json); + localVarResult->fromJson(localVarJson); } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -627,7 +627,7 @@ pplx::task> PetApi::getPetById(int64_t petId) , utility::conversions::to_string_t("error calling getPetById: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task PetApi::updatePet(std::shared_ptr pet) @@ -640,72 +640,72 @@ pplx::task PetApi::updatePet(std::shared_ptr pet) } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->updatePet does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; - consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; - json = ModelBase::toJson(pet); + localVarJson = ModelBase::toJson(pet); - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); if(pet.get()) { - pet->toMultipart(multipart, utility::conversions::to_string_t("pet")); + pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet")); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -715,36 +715,36 @@ pplx::task PetApi::updatePet(std::shared_ptr pet) // authentication (petstore_auth) required // oauth2 authentication is added automatically as part of the http_client_config - return m_ApiClient->callApi(path, utility::conversions::to_string_t("PUT"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling updatePet: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling updatePet: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling updatePet: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling updatePet: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -753,65 +753,65 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optional apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/{petId}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/{petId}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->updatePetWithForm does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; - consumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") ); + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/x-www-form-urlencoded") ); if (name) { - formParams[ utility::conversions::to_string_t("name") ] = ApiClient::parameterToString(*name); + localVarFormParams[ utility::conversions::to_string_t("name") ] = ApiClient::parameterToString(*name); } if (status) { - formParams[ utility::conversions::to_string_t("status") ] = ApiClient::parameterToString(*status); + localVarFormParams[ utility::conversions::to_string_t("status") ] = ApiClient::parameterToString(*status); } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -821,36 +821,36 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optionalcallApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling updatePetWithForm: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling updatePetWithForm: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling updatePetWithForm: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling updatePetWithForm: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -859,66 +859,66 @@ pplx::task> PetApi::uploadFile(int64_t petId, boost { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/pet/{petId}/uploadImage"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/pet/{petId}/uploadImage"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("petId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(petId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("PetApi->uploadFile does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; - consumeHttpContentTypes.insert( utility::conversions::to_string_t("multipart/form-data") ); + std::unordered_set localVarConsumeHttpContentTypes; + localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("multipart/form-data") ); if (additionalMetadata) { - formParams[ utility::conversions::to_string_t("additionalMetadata") ] = ApiClient::parameterToString(*additionalMetadata); + localVarFormParams[ utility::conversions::to_string_t("additionalMetadata") ] = ApiClient::parameterToString(*additionalMetadata); } if (file && *file != nullptr) { - fileParams[ utility::conversions::to_string_t("file") ] = *file; + localVarFileParams[ utility::conversions::to_string_t("file") ] = *file; } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -928,46 +928,46 @@ pplx::task> PetApi::uploadFile(int64_t petId, boost // authentication (petstore_auth) required // oauth2 authentication is added automatically as part of the http_client_config - return m_ApiClient->callApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling uploadFile: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling uploadFile: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling uploadFile: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling uploadFile: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::shared_ptr result(new ApiResponse()); + std::shared_ptr localVarResult(new ApiResponse()); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result->fromJson(json); + localVarResult->fromJson(localVarJson); } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -977,7 +977,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, boost , utility::conversions::to_string_t("error calling uploadFile: unsupported response type")); } - return result; + return localVarResult; }); } diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp index ca188d17328..c690f2be511 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp @@ -39,56 +39,56 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/store/order/{orderId}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("orderId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(orderId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/store/order/{orderId}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("orderId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(orderId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("StoreApi->deleteOrder does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -96,36 +96,36 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("DELETE"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling deleteOrder: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling deleteOrder: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling deleteOrder: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling deleteOrder: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -134,56 +134,56 @@ pplx::task> StoreApi::getInventory() { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/store/inventory"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/store/inventory"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("StoreApi->getInventory does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -192,58 +192,58 @@ pplx::task> StoreApi::getInventory() // authentication (api_key) required { - utility::string_t apiKey = apiConfiguration->getApiKey(utility::conversions::to_string_t("api_key")); - if ( apiKey.size() > 0 ) + utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key")); + if ( localVarApiKey.size() > 0 ) { - headerParams[utility::conversions::to_string_t("api_key")] = apiKey; + localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey; } } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling getInventory: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling getInventory: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling getInventory: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling getInventory: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::map result; + std::map localVarResult; - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - for( auto& item : json.as_object() ) + for( auto& localVarItem : localVarJson.as_object() ) { - result[item.first] = ModelBase::int32_tFromJson(item.second); + localVarResult[localVarItem.first] = ModelBase::int32_tFromJson(localVarItem.second); } } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -253,65 +253,65 @@ pplx::task> StoreApi::getInventory() , utility::conversions::to_string_t("error calling getInventory: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task> StoreApi::getOrderById(int64_t orderId) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/store/order/{orderId}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("orderId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(orderId)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/store/order/{orderId}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("orderId") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(orderId)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("StoreApi->getOrderById does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -319,46 +319,46 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling getOrderById: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling getOrderById: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling getOrderById: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling getOrderById: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::shared_ptr result(new Order()); + std::shared_ptr localVarResult(new Order()); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result->fromJson(json); + localVarResult->fromJson(localVarJson); } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -368,7 +368,7 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) , utility::conversions::to_string_t("error calling getOrderById: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task> StoreApi::placeOrder(std::shared_ptr order) @@ -381,72 +381,72 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr o } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/store/order"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/store/order"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("StoreApi->placeOrder does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; - json = ModelBase::toJson(order); + localVarJson = ModelBase::toJson(order); - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); if(order.get()) { - order->toMultipart(multipart, utility::conversions::to_string_t("order")); + order->toMultipart(localVarMultipart, utility::conversions::to_string_t("order")); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -454,46 +454,46 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr o } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling placeOrder: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling placeOrder: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling placeOrder: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling placeOrder: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::shared_ptr result(new Order()); + std::shared_ptr localVarResult(new Order()); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result->fromJson(json); + localVarResult->fromJson(localVarJson); } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -503,7 +503,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr o , utility::conversions::to_string_t("error calling placeOrder: unsupported response type")); } - return result; + return localVarResult; }); } diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp index 9a466b26c15..af3fb210b68 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp @@ -45,70 +45,70 @@ pplx::task UserApi::createUser(std::shared_ptr user) } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->createUser does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; - json = ModelBase::toJson(user); + localVarJson = ModelBase::toJson(user); - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); if(user.get()) { - user->toMultipart(multipart, utility::conversions::to_string_t("user")); + user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user")); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -116,36 +116,36 @@ pplx::task UserApi::createUser(std::shared_ptr user) } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling createUser: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling createUser: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling createUser: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling createUser: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -154,81 +154,81 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/createWithArray"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/createWithArray"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->createUsersWithArrayInput does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; { - std::vector jsonArray; - for( auto& item : user ) + std::vector localVarJsonArray; + for( auto& localVarItem : user ) { - jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); } - json = web::json::value::array(jsonArray); + localVarJson = web::json::value::array(localVarJsonArray); } - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); { - std::vector jsonArray; - for( auto& item : user ) + std::vector localVarJsonArray; + for( auto& localVarItem : user ) { - jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); } - multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json"))); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), web::json::value::array(localVarJsonArray), utility::conversions::to_string_t("application/json"))); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -236,36 +236,36 @@ pplx::task UserApi::createUsersWithArrayInput(std::vectorcallApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling createUsersWithArrayInput: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling createUsersWithArrayInput: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling createUsersWithArrayInput: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling createUsersWithArrayInput: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -274,81 +274,81 @@ pplx::task UserApi::createUsersWithListInput(std::vector apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/createWithList"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/createWithList"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->createUsersWithListInput does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; { - std::vector jsonArray; - for( auto& item : user ) + std::vector localVarJsonArray; + for( auto& localVarItem : user ) { - jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); } - json = web::json::value::array(jsonArray); + localVarJson = web::json::value::array(localVarJsonArray); } - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); { - std::vector jsonArray; - for( auto& item : user ) + std::vector localVarJsonArray; + for( auto& localVarItem : user ) { - jsonArray.push_back( item.get() ? item->toJson() : web::json::value::null() ); + localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() ); } - multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json"))); + localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), web::json::value::array(localVarJsonArray), utility::conversions::to_string_t("application/json"))); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -356,36 +356,36 @@ pplx::task UserApi::createUsersWithListInput(std::vectorcallApi(path, utility::conversions::to_string_t("POST"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling createUsersWithListInput: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling createUsersWithListInput: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling createUsersWithListInput: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling createUsersWithListInput: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -394,56 +394,56 @@ pplx::task UserApi::deleteUser(utility::string_t username) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/{username}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/{username}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->deleteUser does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -451,36 +451,36 @@ pplx::task UserApi::deleteUser(utility::string_t username) } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("DELETE"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling deleteUser: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling deleteUser: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling deleteUser: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling deleteUser: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -489,58 +489,58 @@ pplx::task> UserApi::getUserByName(utility::string_t usern { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/{username}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/{username}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->getUserByName does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -548,46 +548,46 @@ pplx::task> UserApi::getUserByName(utility::string_t usern } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling getUserByName: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling getUserByName: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling getUserByName: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling getUserByName: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - std::shared_ptr result(new User()); + std::shared_ptr localVarResult(new User()); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result->fromJson(json); + localVarResult->fromJson(localVarJson); } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -597,75 +597,75 @@ pplx::task> UserApi::getUserByName(utility::string_t usern , utility::conversions::to_string_t("error calling getUserByName: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task UserApi::loginUser(utility::string_t username, utility::string_t password) { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/login"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/login"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); - responseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); + std::unordered_set localVarResponseHttpContentTypes; + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") ); + localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") ); - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("text/plain"); + localVarResponseHttpContentType = utility::conversions::to_string_t("text/plain"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } // plain text - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("text/plain")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("text/plain")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("text/plain"); + localVarResponseHttpContentType = utility::conversions::to_string_t("text/plain"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->loginUser does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; { - queryParams[utility::conversions::to_string_t("username")] = ApiClient::parameterToString(username); + localVarQueryParams[utility::conversions::to_string_t("username")] = ApiClient::parameterToString(username); } { - queryParams[utility::conversions::to_string_t("password")] = ApiClient::parameterToString(password); + localVarQueryParams[utility::conversions::to_string_t("password")] = ApiClient::parameterToString(password); } - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -673,51 +673,51 @@ pplx::task UserApi::loginUser(utility::string_t username, uti } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling loginUser: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling loginUser: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling loginUser: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling loginUser: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { - utility::string_t result(utility::conversions::to_string_t("")); + utility::string_t localVarResult(utility::conversions::to_string_t("")); - if(responseHttpContentType == utility::conversions::to_string_t("application/json")) + if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json")) { - web::json::value json = web::json::value::parse(response); + web::json::value localVarJson = web::json::value::parse(localVarResponse); - result = ModelBase::stringFromJson(json); + localVarResult = ModelBase::stringFromJson(localVarJson); } - else if(responseHttpContentType == utility::conversions::to_string_t("text/plain")) + else if(localVarResponseHttpContentType == utility::conversions::to_string_t("text/plain")) { - result = response; + localVarResult = localVarResponse; } - // else if(responseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) + // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data")) // { // TODO multipart response parsing // } @@ -727,62 +727,62 @@ pplx::task UserApi::loginUser(utility::string_t username, uti , utility::conversions::to_string_t("error calling loginUser: unsupported response type")); } - return result; + return localVarResult; }); } pplx::task UserApi::logoutUser() { - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/logout"); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/logout"); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->logoutUser does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { @@ -790,36 +790,36 @@ pplx::task UserApi::logoutUser() } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("GET"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling logoutUser: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling logoutUser: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling logoutUser: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling logoutUser: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); @@ -834,71 +834,71 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); - utility::string_t path = utility::conversions::to_string_t("/user/{username}"); - boost::replace_all(path, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); + std::shared_ptr localVarApiConfiguration( m_ApiClient->getConfiguration() ); + utility::string_t localVarPath = utility::conversions::to_string_t("/user/{username}"); + boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("username") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(username)); - std::map queryParams; - std::map headerParams( apiConfiguration->getDefaultHeaders() ); - std::map formParams; - std::map> fileParams; + std::map localVarQueryParams; + std::map localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() ); + std::map localVarFormParams; + std::map> localVarFileParams; - std::unordered_set responseHttpContentTypes; + std::unordered_set localVarResponseHttpContentTypes; - utility::string_t responseHttpContentType; + utility::string_t localVarResponseHttpContentType; // use JSON if possible - if ( responseHttpContentTypes.size() == 0 ) + if ( localVarResponseHttpContentTypes.size() == 0 ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // JSON - else if ( responseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != responseHttpContentTypes.end() ) + else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("application/json"); + localVarResponseHttpContentType = utility::conversions::to_string_t("application/json"); } // multipart formdata - else if( responseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != responseHttpContentTypes.end() ) + else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() ) { - responseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data"); } else { throw ApiException(400, utility::conversions::to_string_t("UserApi->updateUser does not produce any supported media type")); } - headerParams[utility::conversions::to_string_t("Accept")] = responseHttpContentType; + localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType; - std::unordered_set consumeHttpContentTypes; + std::unordered_set localVarConsumeHttpContentTypes; - std::shared_ptr httpBody; - utility::string_t requestHttpContentType; + std::shared_ptr localVarHttpBody; + utility::string_t localVarRequestHttpContentType; // use JSON if possible - if ( consumeHttpContentTypes.size() == 0 || consumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != consumeHttpContentTypes.end() ) + if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("application/json"); - web::json::value json; + localVarRequestHttpContentType = utility::conversions::to_string_t("application/json"); + web::json::value localVarJson; - json = ModelBase::toJson(user); + localVarJson = ModelBase::toJson(user); - httpBody = std::shared_ptr( new JsonBody( json ) ); + localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) ); } // multipart formdata - else if( consumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != consumeHttpContentTypes.end() ) + else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() ) { - requestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); - std::shared_ptr multipart(new MultipartFormData); + localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data"); + std::shared_ptr localVarMultipart(new MultipartFormData); if(user.get()) { - user->toMultipart(multipart, utility::conversions::to_string_t("user")); + user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user")); } - httpBody = multipart; - requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary(); + localVarHttpBody = localVarMultipart; + localVarRequestHttpContentType += utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary(); } else { @@ -906,36 +906,36 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr } - return m_ApiClient->callApi(path, utility::conversions::to_string_t("PUT"), queryParams, httpBody, headerParams, formParams, fileParams, requestHttpContentType) - .then([=](web::http::http_response response) + return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType) + .then([=](web::http::http_response localVarResponse) { // 1xx - informational : OK // 2xx - successful : OK // 3xx - redirection : OK // 4xx - client error : not OK // 5xx - client error : not OK - if (response.status_code() >= 400) + if (localVarResponse.status_code() >= 400) { - throw ApiException(response.status_code() - , utility::conversions::to_string_t("error calling updateUser: ") + response.reason_phrase() - , std::make_shared(response.extract_utf8string(true).get())); + throw ApiException(localVarResponse.status_code() + , utility::conversions::to_string_t("error calling updateUser: ") + localVarResponse.reason_phrase() + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } // check response content type - if(response.headers().has(utility::conversions::to_string_t("Content-Type"))) + if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type"))) { - utility::string_t contentType = response.headers()[utility::conversions::to_string_t("Content-Type")]; - if( contentType.find(responseHttpContentType) == std::string::npos ) + utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")]; + if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos ) { throw ApiException(500 - , utility::conversions::to_string_t("error calling updateUser: unexpected response type: ") + contentType - , std::make_shared(response.extract_utf8string(true).get())); + , utility::conversions::to_string_t("error calling updateUser: unexpected response type: ") + localVarContentType + , std::make_shared(localVarResponse.extract_utf8string(true).get())); } } - return response.extract_string(); + return localVarResponse.extract_string(); }) - .then([=](utility::string_t response) + .then([=](utility::string_t localVarResponse) { return void(); }); From 0f30a052b2b90a254820f4c2453ffba381cf4a72 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 17 Aug 2018 17:22:30 +0800 Subject: [PATCH 04/37] Add an option to skip "form" model generation (#700) * add option to generate all models * update doc * rename option to skipFormModel * update petstore samples * Update doc * Update samples --- docs/customization.md | 8 + .../codegen/CodegenConstants.java | 1 + .../codegen/DefaultGenerator.java | 15 +- .../lib/OpenAPIPetstore/API/Fake.hs | 6 +- .../lib/OpenAPIPetstore/Model.hs | 259 +++++- .../lib/OpenAPIPetstore/ModelLens.hs | 144 ++++ .../haskell-http-client/tests/Instances.hs | 48 ++ .../haskell-http-client/tests/Test.hs | 6 + .../petstore/php/OpenAPIClient-php/README.md | 6 + .../php/OpenAPIClient-php/docs/Model/Body.md | 11 + .../php/OpenAPIClient-php/docs/Model/Body1.md | 11 + .../php/OpenAPIClient-php/docs/Model/Body2.md | 11 + .../php/OpenAPIClient-php/docs/Model/Body3.md | 23 + .../php/OpenAPIClient-php/docs/Model/Body4.md | 11 + .../php/OpenAPIClient-php/docs/Model/Body5.md | 11 + .../php/OpenAPIClient-php/lib/Model/Body.php | 327 +++++++ .../php/OpenAPIClient-php/lib/Model/Body1.php | 327 +++++++ .../php/OpenAPIClient-php/lib/Model/Body2.php | 385 +++++++++ .../php/OpenAPIClient-php/lib/Model/Body3.php | 805 ++++++++++++++++++ .../php/OpenAPIClient-php/lib/Model/Body4.php | 333 ++++++++ .../php/OpenAPIClient-php/lib/Model/Body5.php | 330 +++++++ .../test/Model/Body1Test.php | 92 ++ .../test/Model/Body2Test.php | 92 ++ .../test/Model/Body3Test.php | 176 ++++ .../test/Model/Body4Test.php | 92 ++ .../test/Model/Body5Test.php | 92 ++ .../OpenAPIClient-php/test/Model/BodyTest.php | 92 ++ 27 files changed, 3702 insertions(+), 12 deletions(-) create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body1.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body2.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body3.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body4.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body5.md create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body1.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body2.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body3.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body4.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body5.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body1Test.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body2Test.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body3Test.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body4Test.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body5Test.php create mode 100644 samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/BodyTest.php diff --git a/docs/customization.md b/docs/customization.md index ec1a534c98d..b9254eab691 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -106,6 +106,14 @@ java -Dapis -DmodelTests=false {opts} When using selective generation, _only_ the templates needed for the specific generation will be used. +To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to false) (this option is introduced at v3.2.2) + +```sh +java -DskipFormModel=true +``` + +This option will be helpful to skip model generation due to the form parameter, which is defined differently in OAS3 as there's no form parameter in OAS3 + ### Ignore file format OpenAPI Generator supports a `.openapi-generator-ignore` file, similar to `.gitignore` or `.dockerignore` you're probably already familiar with. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 9aa86e73645..d96fda52687 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -31,6 +31,7 @@ public class CodegenConstants { public static final String API_TESTS = "apiTests"; public static final String API_DOCS = "apiDocs"; public static final String WITH_XML = "withXml"; + public static final String SKIP_FORM_MODEL = "skipFormModel"; /* /end System Properties */ public static final String API_PACKAGE = "apiPackage"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 1ba9611cfd3..b583079e0ff 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -286,7 +286,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { private void generateModelDocumentation(List files, Map models, String modelName) throws IOException { for (String templateName : config.modelDocTemplateFiles().keySet()) { String docExtension = config.getDocExtension(); - String suffix = docExtension!=null ? docExtension : config.modelDocTemplateFiles().get(templateName); + String suffix = docExtension != null ? docExtension : config.modelDocTemplateFiles().get(templateName); String filename = config.modelDocFileFolder() + File.separator + config.toModelDocFilename(modelName) + suffix; if (!config.shouldOverwrite(filename)) { LOGGER.info("Skipped overwriting " + filename); @@ -382,6 +382,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } */ }); + Boolean skipFormModel = System.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ? + Boolean.valueOf(System.getProperty(CodegenConstants.SKIP_FORM_MODEL)) : + getGeneratorPropertyDefaultSwitch(CodegenConstants.SKIP_FORM_MODEL, false); + // process models only for (String name : modelKeys) { try { @@ -393,8 +397,13 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { // don't generate models that are not used as object (e.g. form parameters) if (unusedModels.contains(name)) { - LOGGER.debug("Model " + name + " not generated since it's marked as unused (due to form parameters)"); - continue; + if (Boolean.FALSE.equals(skipFormModel)) { + // if skipFormModel sets to true, still generate the model and log the result + LOGGER.info("Model " + name + " (marked as unused due to form parameters) is generated due to skipFormModel=false (default)"); + } else { + LOGGER.info("Model " + name + " not generated since it's marked as unused (due to form parameters) and skipFormModel set to true"); + continue; + } } Schema schema = schemas.get(name); diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs index 98881805310..51f5f5e51c7 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs @@ -73,7 +73,7 @@ fakeOuterBooleanSerialize _ = data FakeOuterBooleanSerialize -- | /Body Param/ "body" - Input boolean as post body -instance HasBodyParam FakeOuterBooleanSerialize BodyBool +instance HasBodyParam FakeOuterBooleanSerialize Body8 -- | @application/json@ instance Consumes FakeOuterBooleanSerialize MimeJSON @@ -123,7 +123,7 @@ fakeOuterNumberSerialize _ = data FakeOuterNumberSerialize -- | /Body Param/ "body" - Input number as post body -instance HasBodyParam FakeOuterNumberSerialize Body +instance HasBodyParam FakeOuterNumberSerialize Body6 -- | @application/json@ instance Consumes FakeOuterNumberSerialize MimeJSON @@ -148,7 +148,7 @@ fakeOuterStringSerialize _ = data FakeOuterStringSerialize -- | /Body Param/ "body" - Input string as post body -instance HasBodyParam FakeOuterStringSerialize BodyText +instance HasBodyParam FakeOuterStringSerialize Body7 -- | @application/json@ instance Consumes FakeOuterStringSerialize MimeJSON diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs index cb46c7b8b2c..f4a0f43dbad 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -72,14 +72,14 @@ newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text } -- ** ApiKey newtype ApiKey = ApiKey { unApiKey :: Text } deriving (P.Eq, P.Show) --- ** Body -newtype Body = Body { unBody :: Double } deriving (P.Eq, P.Show, A.ToJSON) +-- ** Body6 +newtype Body6 = Body6 { unBody6 :: Double } deriving (P.Eq, P.Show, A.ToJSON) --- ** BodyBool -newtype BodyBool = BodyBool { unBodyBool :: Bool } deriving (P.Eq, P.Show, A.ToJSON) +-- ** Body7 +newtype Body7 = Body7 { unBody7 :: Text } deriving (P.Eq, P.Show, A.ToJSON) --- ** BodyText -newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON) +-- ** Body8 +newtype Body8 = Body8 { unBody8 :: Bool } deriving (P.Eq, P.Show, A.ToJSON) -- ** Byte newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show) @@ -416,6 +416,253 @@ mkArrayTest = , arrayTestArrayArrayOfModel = Nothing } +-- ** Body +-- | Body +data Body = Body + { bodyName :: !(Maybe Text) -- ^ "name" - Updated name of the pet + , bodyStatus :: !(Maybe Text) -- ^ "status" - Updated status of the pet + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body +instance A.FromJSON Body where + parseJSON = A.withObject "Body" $ \o -> + Body + <$> (o .:? "name") + <*> (o .:? "status") + +-- | ToJSON Body +instance A.ToJSON Body where + toJSON Body {..} = + _omitNulls + [ "name" .= bodyName + , "status" .= bodyStatus + ] + + +-- | Construct a value of type 'Body' (by applying it's required fields, if any) +mkBody + :: Body +mkBody = + Body + { bodyName = Nothing + , bodyStatus = Nothing + } + +-- ** Body1 +-- | Body1 +data Body1 = Body1 + { body1AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server + , body1File :: !(Maybe FilePath) -- ^ "file" - file to upload + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body1 +instance A.FromJSON Body1 where + parseJSON = A.withObject "Body1" $ \o -> + Body1 + <$> (o .:? "additionalMetadata") + <*> (o .:? "file") + +-- | ToJSON Body1 +instance A.ToJSON Body1 where + toJSON Body1 {..} = + _omitNulls + [ "additionalMetadata" .= body1AdditionalMetadata + , "file" .= body1File + ] + + +-- | Construct a value of type 'Body1' (by applying it's required fields, if any) +mkBody1 + :: Body1 +mkBody1 = + Body1 + { body1AdditionalMetadata = Nothing + , body1File = Nothing + } + +-- ** Body2 +-- | Body2 +data Body2 = Body2 + { body2EnumFormStringArray :: !(Maybe [E'EnumFormStringArray]) -- ^ "enum_form_string_array" - Form parameter enum test (string array) + , body2EnumFormString :: !(Maybe E'EnumFormString) -- ^ "enum_form_string" - Form parameter enum test (string) + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body2 +instance A.FromJSON Body2 where + parseJSON = A.withObject "Body2" $ \o -> + Body2 + <$> (o .:? "enum_form_string_array") + <*> (o .:? "enum_form_string") + +-- | ToJSON Body2 +instance A.ToJSON Body2 where + toJSON Body2 {..} = + _omitNulls + [ "enum_form_string_array" .= body2EnumFormStringArray + , "enum_form_string" .= body2EnumFormString + ] + + +-- | Construct a value of type 'Body2' (by applying it's required fields, if any) +mkBody2 + :: Body2 +mkBody2 = + Body2 + { body2EnumFormStringArray = Nothing + , body2EnumFormString = Nothing + } + +-- ** Body3 +-- | Body3 +data Body3 = Body3 + { body3Integer :: !(Maybe Int) -- ^ "integer" - None + , body3Int32 :: !(Maybe Int) -- ^ "int32" - None + , body3Int64 :: !(Maybe Integer) -- ^ "int64" - None + , body3Number :: !(Double) -- ^ /Required/ "number" - None + , body3Float :: !(Maybe Float) -- ^ "float" - None + , body3Double :: !(Double) -- ^ /Required/ "double" - None + , body3String :: !(Maybe Text) -- ^ "string" - None + , body3PatternWithoutDelimiter :: !(Text) -- ^ /Required/ "pattern_without_delimiter" - None + , body3Byte :: !(ByteArray) -- ^ /Required/ "byte" - None + , body3Binary :: !(Maybe FilePath) -- ^ "binary" - None + , body3Date :: !(Maybe Date) -- ^ "date" - None + , body3DateTime :: !(Maybe DateTime) -- ^ "dateTime" - None + , body3Password :: !(Maybe Text) -- ^ "password" - None + , body3Callback :: !(Maybe Text) -- ^ "callback" - None + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body3 +instance A.FromJSON Body3 where + parseJSON = A.withObject "Body3" $ \o -> + Body3 + <$> (o .:? "integer") + <*> (o .:? "int32") + <*> (o .:? "int64") + <*> (o .: "number") + <*> (o .:? "float") + <*> (o .: "double") + <*> (o .:? "string") + <*> (o .: "pattern_without_delimiter") + <*> (o .: "byte") + <*> (o .:? "binary") + <*> (o .:? "date") + <*> (o .:? "dateTime") + <*> (o .:? "password") + <*> (o .:? "callback") + +-- | ToJSON Body3 +instance A.ToJSON Body3 where + toJSON Body3 {..} = + _omitNulls + [ "integer" .= body3Integer + , "int32" .= body3Int32 + , "int64" .= body3Int64 + , "number" .= body3Number + , "float" .= body3Float + , "double" .= body3Double + , "string" .= body3String + , "pattern_without_delimiter" .= body3PatternWithoutDelimiter + , "byte" .= body3Byte + , "binary" .= body3Binary + , "date" .= body3Date + , "dateTime" .= body3DateTime + , "password" .= body3Password + , "callback" .= body3Callback + ] + + +-- | Construct a value of type 'Body3' (by applying it's required fields, if any) +mkBody3 + :: Double -- ^ 'body3Number': None + -> Double -- ^ 'body3Double': None + -> Text -- ^ 'body3PatternWithoutDelimiter': None + -> ByteArray -- ^ 'body3Byte': None + -> Body3 +mkBody3 body3Number body3Double body3PatternWithoutDelimiter body3Byte = + Body3 + { body3Integer = Nothing + , body3Int32 = Nothing + , body3Int64 = Nothing + , body3Number + , body3Float = Nothing + , body3Double + , body3String = Nothing + , body3PatternWithoutDelimiter + , body3Byte + , body3Binary = Nothing + , body3Date = Nothing + , body3DateTime = Nothing + , body3Password = Nothing + , body3Callback = Nothing + } + +-- ** Body4 +-- | Body4 +data Body4 = Body4 + { body4Param :: !(Text) -- ^ /Required/ "param" - field1 + , body4Param2 :: !(Text) -- ^ /Required/ "param2" - field2 + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body4 +instance A.FromJSON Body4 where + parseJSON = A.withObject "Body4" $ \o -> + Body4 + <$> (o .: "param") + <*> (o .: "param2") + +-- | ToJSON Body4 +instance A.ToJSON Body4 where + toJSON Body4 {..} = + _omitNulls + [ "param" .= body4Param + , "param2" .= body4Param2 + ] + + +-- | Construct a value of type 'Body4' (by applying it's required fields, if any) +mkBody4 + :: Text -- ^ 'body4Param': field1 + -> Text -- ^ 'body4Param2': field2 + -> Body4 +mkBody4 body4Param body4Param2 = + Body4 + { body4Param + , body4Param2 + } + +-- ** Body5 +-- | Body5 +data Body5 = Body5 + { body5AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server + , body5RequiredFile :: !(FilePath) -- ^ /Required/ "requiredFile" - file to upload + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON Body5 +instance A.FromJSON Body5 where + parseJSON = A.withObject "Body5" $ \o -> + Body5 + <$> (o .:? "additionalMetadata") + <*> (o .: "requiredFile") + +-- | ToJSON Body5 +instance A.ToJSON Body5 where + toJSON Body5 {..} = + _omitNulls + [ "additionalMetadata" .= body5AdditionalMetadata + , "requiredFile" .= body5RequiredFile + ] + + +-- | Construct a value of type 'Body5' (by applying it's required fields, if any) +mkBody5 + :: FilePath -- ^ 'body5RequiredFile': file to upload + -> Body5 +mkBody5 body5RequiredFile = + Body5 + { body5AdditionalMetadata = Nothing + , body5RequiredFile + } + -- ** Capitalization -- | Capitalization data Capitalization = Capitalization diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs index f30ff167e37..317dbe109c8 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs @@ -124,6 +124,150 @@ arrayTestArrayArrayOfModelL f ArrayTest{..} = (\arrayTestArrayArrayOfModel -> Ar +-- * Body + +-- | 'bodyName' Lens +bodyNameL :: Lens_' Body (Maybe Text) +bodyNameL f Body{..} = (\bodyName -> Body { bodyName, ..} ) <$> f bodyName +{-# INLINE bodyNameL #-} + +-- | 'bodyStatus' Lens +bodyStatusL :: Lens_' Body (Maybe Text) +bodyStatusL f Body{..} = (\bodyStatus -> Body { bodyStatus, ..} ) <$> f bodyStatus +{-# INLINE bodyStatusL #-} + + + +-- * Body1 + +-- | 'body1AdditionalMetadata' Lens +body1AdditionalMetadataL :: Lens_' Body1 (Maybe Text) +body1AdditionalMetadataL f Body1{..} = (\body1AdditionalMetadata -> Body1 { body1AdditionalMetadata, ..} ) <$> f body1AdditionalMetadata +{-# INLINE body1AdditionalMetadataL #-} + +-- | 'body1File' Lens +body1FileL :: Lens_' Body1 (Maybe FilePath) +body1FileL f Body1{..} = (\body1File -> Body1 { body1File, ..} ) <$> f body1File +{-# INLINE body1FileL #-} + + + +-- * Body2 + +-- | 'body2EnumFormStringArray' Lens +body2EnumFormStringArrayL :: Lens_' Body2 (Maybe [E'EnumFormStringArray]) +body2EnumFormStringArrayL f Body2{..} = (\body2EnumFormStringArray -> Body2 { body2EnumFormStringArray, ..} ) <$> f body2EnumFormStringArray +{-# INLINE body2EnumFormStringArrayL #-} + +-- | 'body2EnumFormString' Lens +body2EnumFormStringL :: Lens_' Body2 (Maybe E'EnumFormString) +body2EnumFormStringL f Body2{..} = (\body2EnumFormString -> Body2 { body2EnumFormString, ..} ) <$> f body2EnumFormString +{-# INLINE body2EnumFormStringL #-} + + + +-- * Body3 + +-- | 'body3Integer' Lens +body3IntegerL :: Lens_' Body3 (Maybe Int) +body3IntegerL f Body3{..} = (\body3Integer -> Body3 { body3Integer, ..} ) <$> f body3Integer +{-# INLINE body3IntegerL #-} + +-- | 'body3Int32' Lens +body3Int32L :: Lens_' Body3 (Maybe Int) +body3Int32L f Body3{..} = (\body3Int32 -> Body3 { body3Int32, ..} ) <$> f body3Int32 +{-# INLINE body3Int32L #-} + +-- | 'body3Int64' Lens +body3Int64L :: Lens_' Body3 (Maybe Integer) +body3Int64L f Body3{..} = (\body3Int64 -> Body3 { body3Int64, ..} ) <$> f body3Int64 +{-# INLINE body3Int64L #-} + +-- | 'body3Number' Lens +body3NumberL :: Lens_' Body3 (Double) +body3NumberL f Body3{..} = (\body3Number -> Body3 { body3Number, ..} ) <$> f body3Number +{-# INLINE body3NumberL #-} + +-- | 'body3Float' Lens +body3FloatL :: Lens_' Body3 (Maybe Float) +body3FloatL f Body3{..} = (\body3Float -> Body3 { body3Float, ..} ) <$> f body3Float +{-# INLINE body3FloatL #-} + +-- | 'body3Double' Lens +body3DoubleL :: Lens_' Body3 (Double) +body3DoubleL f Body3{..} = (\body3Double -> Body3 { body3Double, ..} ) <$> f body3Double +{-# INLINE body3DoubleL #-} + +-- | 'body3String' Lens +body3StringL :: Lens_' Body3 (Maybe Text) +body3StringL f Body3{..} = (\body3String -> Body3 { body3String, ..} ) <$> f body3String +{-# INLINE body3StringL #-} + +-- | 'body3PatternWithoutDelimiter' Lens +body3PatternWithoutDelimiterL :: Lens_' Body3 (Text) +body3PatternWithoutDelimiterL f Body3{..} = (\body3PatternWithoutDelimiter -> Body3 { body3PatternWithoutDelimiter, ..} ) <$> f body3PatternWithoutDelimiter +{-# INLINE body3PatternWithoutDelimiterL #-} + +-- | 'body3Byte' Lens +body3ByteL :: Lens_' Body3 (ByteArray) +body3ByteL f Body3{..} = (\body3Byte -> Body3 { body3Byte, ..} ) <$> f body3Byte +{-# INLINE body3ByteL #-} + +-- | 'body3Binary' Lens +body3BinaryL :: Lens_' Body3 (Maybe FilePath) +body3BinaryL f Body3{..} = (\body3Binary -> Body3 { body3Binary, ..} ) <$> f body3Binary +{-# INLINE body3BinaryL #-} + +-- | 'body3Date' Lens +body3DateL :: Lens_' Body3 (Maybe Date) +body3DateL f Body3{..} = (\body3Date -> Body3 { body3Date, ..} ) <$> f body3Date +{-# INLINE body3DateL #-} + +-- | 'body3DateTime' Lens +body3DateTimeL :: Lens_' Body3 (Maybe DateTime) +body3DateTimeL f Body3{..} = (\body3DateTime -> Body3 { body3DateTime, ..} ) <$> f body3DateTime +{-# INLINE body3DateTimeL #-} + +-- | 'body3Password' Lens +body3PasswordL :: Lens_' Body3 (Maybe Text) +body3PasswordL f Body3{..} = (\body3Password -> Body3 { body3Password, ..} ) <$> f body3Password +{-# INLINE body3PasswordL #-} + +-- | 'body3Callback' Lens +body3CallbackL :: Lens_' Body3 (Maybe Text) +body3CallbackL f Body3{..} = (\body3Callback -> Body3 { body3Callback, ..} ) <$> f body3Callback +{-# INLINE body3CallbackL #-} + + + +-- * Body4 + +-- | 'body4Param' Lens +body4ParamL :: Lens_' Body4 (Text) +body4ParamL f Body4{..} = (\body4Param -> Body4 { body4Param, ..} ) <$> f body4Param +{-# INLINE body4ParamL #-} + +-- | 'body4Param2' Lens +body4Param2L :: Lens_' Body4 (Text) +body4Param2L f Body4{..} = (\body4Param2 -> Body4 { body4Param2, ..} ) <$> f body4Param2 +{-# INLINE body4Param2L #-} + + + +-- * Body5 + +-- | 'body5AdditionalMetadata' Lens +body5AdditionalMetadataL :: Lens_' Body5 (Maybe Text) +body5AdditionalMetadataL f Body5{..} = (\body5AdditionalMetadata -> Body5 { body5AdditionalMetadata, ..} ) <$> f body5AdditionalMetadata +{-# INLINE body5AdditionalMetadataL #-} + +-- | 'body5RequiredFile' Lens +body5RequiredFileL :: Lens_' Body5 (FilePath) +body5RequiredFileL f Body5{..} = (\body5RequiredFile -> Body5 { body5RequiredFile, ..} ) <$> f body5RequiredFile +{-# INLINE body5RequiredFileL #-} + + + -- * Capitalization -- | 'capitalizationSmallCamel' Lens diff --git a/samples/client/petstore/haskell-http-client/tests/Instances.hs b/samples/client/petstore/haskell-http-client/tests/Instances.hs index 14cef8e188c..6e54830ccfa 100644 --- a/samples/client/petstore/haskell-http-client/tests/Instances.hs +++ b/samples/client/petstore/haskell-http-client/tests/Instances.hs @@ -130,6 +130,54 @@ instance Arbitrary ArrayTest where <*> arbitrary -- arrayTestArrayArrayOfInteger :: Maybe [[Integer]] <*> arbitrary -- arrayTestArrayArrayOfModel :: Maybe [[ReadOnlyFirst]] +instance Arbitrary Body where + arbitrary = + Body + <$> arbitrary -- bodyName :: Maybe Text + <*> arbitrary -- bodyStatus :: Maybe Text + +instance Arbitrary Body1 where + arbitrary = + Body1 + <$> arbitrary -- body1AdditionalMetadata :: Maybe Text + <*> arbitrary -- body1File :: Maybe FilePath + +instance Arbitrary Body2 where + arbitrary = + Body2 + <$> arbitrary -- body2EnumFormStringArray :: Maybe [Text] + <*> arbitrary -- body2EnumFormString :: Maybe Text + +instance Arbitrary Body3 where + arbitrary = + Body3 + <$> arbitrary -- body3Integer :: Maybe Int + <*> arbitrary -- body3Int32 :: Maybe Int + <*> arbitrary -- body3Int64 :: Maybe Integer + <*> arbitrary -- body3Number :: Double + <*> arbitrary -- body3Float :: Maybe Float + <*> arbitrary -- body3Double :: Double + <*> arbitrary -- body3String :: Maybe Text + <*> arbitrary -- body3PatternWithoutDelimiter :: Text + <*> arbitrary -- body3Byte :: ByteArray + <*> arbitrary -- body3Binary :: Maybe FilePath + <*> arbitrary -- body3Date :: Maybe Date + <*> arbitrary -- body3DateTime :: Maybe DateTime + <*> arbitrary -- body3Password :: Maybe Text + <*> arbitrary -- body3Callback :: Maybe Text + +instance Arbitrary Body4 where + arbitrary = + Body4 + <$> arbitrary -- body4Param :: Text + <*> arbitrary -- body4Param2 :: Text + +instance Arbitrary Body5 where + arbitrary = + Body5 + <$> arbitrary -- body5AdditionalMetadata :: Maybe Text + <*> arbitrary -- body5RequiredFile :: FilePath + instance Arbitrary Capitalization where arbitrary = Capitalization diff --git a/samples/client/petstore/haskell-http-client/tests/Test.hs b/samples/client/petstore/haskell-http-client/tests/Test.hs index ea6fff251e3..ee6483020f4 100644 --- a/samples/client/petstore/haskell-http-client/tests/Test.hs +++ b/samples/client/petstore/haskell-http-client/tests/Test.hs @@ -27,6 +27,12 @@ main = propMimeEq MimeJSON (Proxy :: Proxy ArrayOfArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayTest) + propMimeEq MimeJSON (Proxy :: Proxy Body) + propMimeEq MimeJSON (Proxy :: Proxy Body1) + propMimeEq MimeJSON (Proxy :: Proxy Body2) + propMimeEq MimeJSON (Proxy :: Proxy Body3) + propMimeEq MimeJSON (Proxy :: Proxy Body4) + propMimeEq MimeJSON (Proxy :: Proxy Body5) propMimeEq MimeJSON (Proxy :: Proxy Capitalization) propMimeEq MimeJSON (Proxy :: Proxy Cat) propMimeEq MimeJSON (Proxy :: Proxy Category) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md index 4ae16d9d864..b42462087c7 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md @@ -124,6 +124,12 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/Model/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/Model/ArrayOfNumberOnly.md) - [ArrayTest](docs/Model/ArrayTest.md) + - [Body](docs/Model/Body.md) + - [Body1](docs/Model/Body1.md) + - [Body2](docs/Model/Body2.md) + - [Body3](docs/Model/Body3.md) + - [Body4](docs/Model/Body4.md) + - [Body5](docs/Model/Body5.md) - [Capitalization](docs/Model/Capitalization.md) - [Cat](docs/Model/Cat.md) - [Category](docs/Model/Category.md) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body.md new file mode 100644 index 00000000000..c3cbc85ee89 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body.md @@ -0,0 +1,11 @@ +# Body + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Updated name of the pet | [optional] +**status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body1.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body1.md new file mode 100644 index 00000000000..8f063c22f08 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body1.md @@ -0,0 +1,11 @@ +# Body1 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **string** | Additional data to pass to server | [optional] +**file** | [**\SplFileObject**](\SplFileObject.md) | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body2.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body2.md new file mode 100644 index 00000000000..5afe5ce7313 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body2.md @@ -0,0 +1,11 @@ +# Body2 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_form_string_array** | **string[]** | Form parameter enum test (string array) | [optional] +**enum_form_string** | **string** | Form parameter enum test (string) | [optional] [default to '-efg'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body3.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body3.md new file mode 100644 index 00000000000..fe21931b97d --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body3.md @@ -0,0 +1,23 @@ +# Body3 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | None | [optional] +**int32** | **int** | None | [optional] +**int64** | **int** | None | [optional] +**number** | **float** | None | +**float** | **float** | None | [optional] +**double** | **double** | None | +**string** | **string** | None | [optional] +**pattern_without_delimiter** | **string** | None | +**byte** | **string** | None | +**binary** | [**\SplFileObject**](\SplFileObject.md) | None | [optional] +**date** | [**\DateTime**](\DateTime.md) | None | [optional] +**date_time** | [**\DateTime**](\DateTime.md) | None | [optional] +**password** | **string** | None | [optional] +**callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body4.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body4.md new file mode 100644 index 00000000000..f583ce67bec --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body4.md @@ -0,0 +1,11 @@ +# Body4 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **string** | field1 | +**param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body5.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body5.md new file mode 100644 index 00000000000..bb39fd91717 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/Body5.md @@ -0,0 +1,11 @@ +# Body5 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **string** | Additional data to pass to server | [optional] +**required_file** | [**\SplFileObject**](\SplFileObject.md) | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body.php new file mode 100644 index 00000000000..b37b54099eb --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body.php @@ -0,0 +1,327 @@ + 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'status' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Updated name of the pet + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Updated status of the pet + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body1.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body1.php new file mode 100644 index 00000000000..f7b43d84adf --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body1.php @@ -0,0 +1,327 @@ + 'string', + 'file' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'additional_metadata' => null, + 'file' => 'binary' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'additional_metadata' => 'additionalMetadata', + 'file' => 'file' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'additional_metadata' => 'setAdditionalMetadata', + 'file' => 'setFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'additional_metadata' => 'getAdditionalMetadata', + 'file' => 'getFile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; + $this->container['file'] = isset($data['file']) ? $data['file'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets additional_metadata + * + * @return string|null + */ + public function getAdditionalMetadata() + { + return $this->container['additional_metadata']; + } + + /** + * Sets additional_metadata + * + * @param string|null $additional_metadata Additional data to pass to server + * + * @return $this + */ + public function setAdditionalMetadata($additional_metadata) + { + $this->container['additional_metadata'] = $additional_metadata; + + return $this; + } + + /** + * Gets file + * + * @return \SplFileObject|null + */ + public function getFile() + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param \SplFileObject|null $file file to upload + * + * @return $this + */ + public function setFile($file) + { + $this->container['file'] = $file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body2.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body2.php new file mode 100644 index 00000000000..38a56c52dc0 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body2.php @@ -0,0 +1,385 @@ + 'string[]', + 'enum_form_string' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'enum_form_string_array' => null, + 'enum_form_string' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enum_form_string_array' => 'enum_form_string_array', + 'enum_form_string' => 'enum_form_string' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enum_form_string_array' => 'setEnumFormStringArray', + 'enum_form_string' => 'setEnumFormString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enum_form_string_array' => 'getEnumFormStringArray', + 'enum_form_string' => 'getEnumFormString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const ENUM_FORM_STRING_ARRAY_GREATER_THAN = '>'; + const ENUM_FORM_STRING_ARRAY_DOLLAR = '$'; + const ENUM_FORM_STRING_ABC = '_abc'; + const ENUM_FORM_STRING_EFG = '-efg'; + const ENUM_FORM_STRING_XYZ = '(xyz)'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEnumFormStringArrayAllowableValues() + { + return [ + self::ENUM_FORM_STRING_ARRAY_GREATER_THAN, + self::ENUM_FORM_STRING_ARRAY_DOLLAR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEnumFormStringAllowableValues() + { + return [ + self::ENUM_FORM_STRING_ABC, + self::ENUM_FORM_STRING_EFG, + self::ENUM_FORM_STRING_XYZ, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['enum_form_string_array'] = isset($data['enum_form_string_array']) ? $data['enum_form_string_array'] : null; + $this->container['enum_form_string'] = isset($data['enum_form_string']) ? $data['enum_form_string'] : '-efg'; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getEnumFormStringAllowableValues(); + if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'enum_form_string', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enum_form_string_array + * + * @return string[]|null + */ + public function getEnumFormStringArray() + { + return $this->container['enum_form_string_array']; + } + + /** + * Sets enum_form_string_array + * + * @param string[]|null $enum_form_string_array Form parameter enum test (string array) + * + * @return $this + */ + public function setEnumFormStringArray($enum_form_string_array) + { + $allowedValues = $this->getEnumFormStringArrayAllowableValues(); + if (!is_null($enum_form_string_array) && array_diff($enum_form_string_array, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'enum_form_string_array', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['enum_form_string_array'] = $enum_form_string_array; + + return $this; + } + + /** + * Gets enum_form_string + * + * @return string|null + */ + public function getEnumFormString() + { + return $this->container['enum_form_string']; + } + + /** + * Sets enum_form_string + * + * @param string|null $enum_form_string Form parameter enum test (string) + * + * @return $this + */ + public function setEnumFormString($enum_form_string) + { + $allowedValues = $this->getEnumFormStringAllowableValues(); + if (!is_null($enum_form_string) && !in_array($enum_form_string, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'enum_form_string', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['enum_form_string'] = $enum_form_string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body3.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body3.php new file mode 100644 index 00000000000..e5ef4ec8881 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body3.php @@ -0,0 +1,805 @@ + 'int', + 'int32' => 'int', + 'int64' => 'int', + 'number' => 'float', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'pattern_without_delimiter' => 'string', + 'byte' => 'string', + 'binary' => '\SplFileObject', + 'date' => '\DateTime', + 'date_time' => '\DateTime', + 'password' => 'string', + 'callback' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'integer' => 'int32', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => null, + 'float' => 'float', + 'double' => 'double', + 'string' => null, + 'pattern_without_delimiter' => null, + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'date-time', + 'password' => 'password', + 'callback' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'integer' => 'integer', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => 'number', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'pattern_without_delimiter' => 'pattern_without_delimiter', + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'dateTime', + 'password' => 'password', + 'callback' => 'callback' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'integer' => 'setInteger', + 'int32' => 'setInt32', + 'int64' => 'setInt64', + 'number' => 'setNumber', + 'float' => 'setFloat', + 'double' => 'setDouble', + 'string' => 'setString', + 'pattern_without_delimiter' => 'setPatternWithoutDelimiter', + 'byte' => 'setByte', + 'binary' => 'setBinary', + 'date' => 'setDate', + 'date_time' => 'setDateTime', + 'password' => 'setPassword', + 'callback' => 'setCallback' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'integer' => 'getInteger', + 'int32' => 'getInt32', + 'int64' => 'getInt64', + 'number' => 'getNumber', + 'float' => 'getFloat', + 'double' => 'getDouble', + 'string' => 'getString', + 'pattern_without_delimiter' => 'getPatternWithoutDelimiter', + 'byte' => 'getByte', + 'binary' => 'getBinary', + 'date' => 'getDate', + 'date_time' => 'getDateTime', + 'password' => 'getPassword', + 'callback' => 'getCallback' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['pattern_without_delimiter'] = isset($data['pattern_without_delimiter']) ? $data['pattern_without_delimiter'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['callback'] = isset($data['callback']) ? $data['callback'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['integer']) && ($this->container['integer'] > 100)) { + $invalidProperties[] = "invalid value for 'integer', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['integer']) && ($this->container['integer'] < 10)) { + $invalidProperties[] = "invalid value for 'integer', must be bigger than or equal to 10."; + } + + if (!is_null($this->container['int32']) && ($this->container['int32'] > 200)) { + $invalidProperties[] = "invalid value for 'int32', must be smaller than or equal to 200."; + } + + if (!is_null($this->container['int32']) && ($this->container['int32'] < 20)) { + $invalidProperties[] = "invalid value for 'int32', must be bigger than or equal to 20."; + } + + if ($this->container['number'] === null) { + $invalidProperties[] = "'number' can't be null"; + } + if (($this->container['number'] > 543.2)) { + $invalidProperties[] = "invalid value for 'number', must be smaller than or equal to 543.2."; + } + + if (($this->container['number'] < 32.1)) { + $invalidProperties[] = "invalid value for 'number', must be bigger than or equal to 32.1."; + } + + if (!is_null($this->container['float']) && ($this->container['float'] > 987.6)) { + $invalidProperties[] = "invalid value for 'float', must be smaller than or equal to 987.6."; + } + + if ($this->container['double'] === null) { + $invalidProperties[] = "'double' can't be null"; + } + if (($this->container['double'] > 123.4)) { + $invalidProperties[] = "invalid value for 'double', must be smaller than or equal to 123.4."; + } + + if (($this->container['double'] < 67.8)) { + $invalidProperties[] = "invalid value for 'double', must be bigger than or equal to 67.8."; + } + + if (!is_null($this->container['string']) && !preg_match("/[a-z]/i", $this->container['string'])) { + $invalidProperties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i."; + } + + if ($this->container['pattern_without_delimiter'] === null) { + $invalidProperties[] = "'pattern_without_delimiter' can't be null"; + } + if (!preg_match("/^[A-Z].*/", $this->container['pattern_without_delimiter'])) { + $invalidProperties[] = "invalid value for 'pattern_without_delimiter', must be conform to the pattern /^[A-Z].*/."; + } + + if ($this->container['byte'] === null) { + $invalidProperties[] = "'byte' can't be null"; + } + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 64)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 64."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) < 10)) { + $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 10."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets integer + * + * @return int|null + */ + public function getInteger() + { + return $this->container['integer']; + } + + /** + * Sets integer + * + * @param int|null $integer None + * + * @return $this + */ + public function setInteger($integer) + { + + if (!is_null($integer) && ($integer > 100)) { + throw new \InvalidArgumentException('invalid value for $integer when calling Body3., must be smaller than or equal to 100.'); + } + if (!is_null($integer) && ($integer < 10)) { + throw new \InvalidArgumentException('invalid value for $integer when calling Body3., must be bigger than or equal to 10.'); + } + + $this->container['integer'] = $integer; + + return $this; + } + + /** + * Gets int32 + * + * @return int|null + */ + public function getInt32() + { + return $this->container['int32']; + } + + /** + * Sets int32 + * + * @param int|null $int32 None + * + * @return $this + */ + public function setInt32($int32) + { + + if (!is_null($int32) && ($int32 > 200)) { + throw new \InvalidArgumentException('invalid value for $int32 when calling Body3., must be smaller than or equal to 200.'); + } + if (!is_null($int32) && ($int32 < 20)) { + throw new \InvalidArgumentException('invalid value for $int32 when calling Body3., must be bigger than or equal to 20.'); + } + + $this->container['int32'] = $int32; + + return $this; + } + + /** + * Gets int64 + * + * @return int|null + */ + public function getInt64() + { + return $this->container['int64']; + } + + /** + * Sets int64 + * + * @param int|null $int64 None + * + * @return $this + */ + public function setInt64($int64) + { + $this->container['int64'] = $int64; + + return $this; + } + + /** + * Gets number + * + * @return float + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param float $number None + * + * @return $this + */ + public function setNumber($number) + { + + if (($number > 543.2)) { + throw new \InvalidArgumentException('invalid value for $number when calling Body3., must be smaller than or equal to 543.2.'); + } + if (($number < 32.1)) { + throw new \InvalidArgumentException('invalid value for $number when calling Body3., must be bigger than or equal to 32.1.'); + } + + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets float + * + * @return float|null + */ + public function getFloat() + { + return $this->container['float']; + } + + /** + * Sets float + * + * @param float|null $float None + * + * @return $this + */ + public function setFloat($float) + { + + if (!is_null($float) && ($float > 987.6)) { + throw new \InvalidArgumentException('invalid value for $float when calling Body3., must be smaller than or equal to 987.6.'); + } + + $this->container['float'] = $float; + + return $this; + } + + /** + * Gets double + * + * @return double + */ + public function getDouble() + { + return $this->container['double']; + } + + /** + * Sets double + * + * @param double $double None + * + * @return $this + */ + public function setDouble($double) + { + + if (($double > 123.4)) { + throw new \InvalidArgumentException('invalid value for $double when calling Body3., must be smaller than or equal to 123.4.'); + } + if (($double < 67.8)) { + throw new \InvalidArgumentException('invalid value for $double when calling Body3., must be bigger than or equal to 67.8.'); + } + + $this->container['double'] = $double; + + return $this; + } + + /** + * Gets string + * + * @return string|null + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param string|null $string None + * + * @return $this + */ + public function setString($string) + { + + if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) { + throw new \InvalidArgumentException("invalid value for $string when calling Body3., must conform to the pattern /[a-z]/i."); + } + + $this->container['string'] = $string; + + return $this; + } + + /** + * Gets pattern_without_delimiter + * + * @return string + */ + public function getPatternWithoutDelimiter() + { + return $this->container['pattern_without_delimiter']; + } + + /** + * Sets pattern_without_delimiter + * + * @param string $pattern_without_delimiter None + * + * @return $this + */ + public function setPatternWithoutDelimiter($pattern_without_delimiter) + { + + if ((!preg_match("/^[A-Z].*/", $pattern_without_delimiter))) { + throw new \InvalidArgumentException("invalid value for $pattern_without_delimiter when calling Body3., must conform to the pattern /^[A-Z].*/."); + } + + $this->container['pattern_without_delimiter'] = $pattern_without_delimiter; + + return $this; + } + + /** + * Gets byte + * + * @return string + */ + public function getByte() + { + return $this->container['byte']; + } + + /** + * Sets byte + * + * @param string $byte None + * + * @return $this + */ + public function setByte($byte) + { + $this->container['byte'] = $byte; + + return $this; + } + + /** + * Gets binary + * + * @return \SplFileObject|null + */ + public function getBinary() + { + return $this->container['binary']; + } + + /** + * Sets binary + * + * @param \SplFileObject|null $binary None + * + * @return $this + */ + public function setBinary($binary) + { + $this->container['binary'] = $binary; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date None + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets date_time + * + * @return \DateTime|null + */ + public function getDateTime() + { + return $this->container['date_time']; + } + + /** + * Sets date_time + * + * @param \DateTime|null $date_time None + * + * @return $this + */ + public function setDateTime($date_time) + { + $this->container['date_time'] = $date_time; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password None + * + * @return $this + */ + public function setPassword($password) + { + if (!is_null($password) && (mb_strlen($password) > 64)) { + throw new \InvalidArgumentException('invalid length for $password when calling Body3., must be smaller than or equal to 64.'); + } + if (!is_null($password) && (mb_strlen($password) < 10)) { + throw new \InvalidArgumentException('invalid length for $password when calling Body3., must be bigger than or equal to 10.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets callback + * + * @return string|null + */ + public function getCallback() + { + return $this->container['callback']; + } + + /** + * Sets callback + * + * @param string|null $callback None + * + * @return $this + */ + public function setCallback($callback) + { + $this->container['callback'] = $callback; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body4.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body4.php new file mode 100644 index 00000000000..fdbe3fba12e --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body4.php @@ -0,0 +1,333 @@ + 'string', + 'param2' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'param' => null, + 'param2' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'param' => 'param', + 'param2' => 'param2' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'param' => 'setParam', + 'param2' => 'setParam2' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'param' => 'getParam', + 'param2' => 'getParam2' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['param'] = isset($data['param']) ? $data['param'] : null; + $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['param'] === null) { + $invalidProperties[] = "'param' can't be null"; + } + if ($this->container['param2'] === null) { + $invalidProperties[] = "'param2' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets param + * + * @return string + */ + public function getParam() + { + return $this->container['param']; + } + + /** + * Sets param + * + * @param string $param field1 + * + * @return $this + */ + public function setParam($param) + { + $this->container['param'] = $param; + + return $this; + } + + /** + * Gets param2 + * + * @return string + */ + public function getParam2() + { + return $this->container['param2']; + } + + /** + * Sets param2 + * + * @param string $param2 field2 + * + * @return $this + */ + public function setParam2($param2) + { + $this->container['param2'] = $param2; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body5.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body5.php new file mode 100644 index 00000000000..6e81d36b266 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Body5.php @@ -0,0 +1,330 @@ + 'string', + 'required_file' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'additional_metadata' => null, + 'required_file' => 'binary' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'additional_metadata' => 'additionalMetadata', + 'required_file' => 'requiredFile' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'additional_metadata' => 'setAdditionalMetadata', + 'required_file' => 'setRequiredFile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'additional_metadata' => 'getAdditionalMetadata', + 'required_file' => 'getRequiredFile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; + $this->container['required_file'] = isset($data['required_file']) ? $data['required_file'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['required_file'] === null) { + $invalidProperties[] = "'required_file' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets additional_metadata + * + * @return string|null + */ + public function getAdditionalMetadata() + { + return $this->container['additional_metadata']; + } + + /** + * Sets additional_metadata + * + * @param string|null $additional_metadata Additional data to pass to server + * + * @return $this + */ + public function setAdditionalMetadata($additional_metadata) + { + $this->container['additional_metadata'] = $additional_metadata; + + return $this; + } + + /** + * Gets required_file + * + * @return \SplFileObject + */ + public function getRequiredFile() + { + return $this->container['required_file']; + } + + /** + * Sets required_file + * + * @param \SplFileObject $required_file file to upload + * + * @return $this + */ + public function setRequiredFile($required_file) + { + $this->container['required_file'] = $required_file; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body1Test.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body1Test.php new file mode 100644 index 00000000000..710ebc4d0d0 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/Body1Test.php @@ -0,0 +1,92 @@ + Date: Fri, 17 Aug 2018 19:15:02 +0300 Subject: [PATCH 05/37] [Java][Rest-assured] Fix generated javadoc and "swagger-annotations" improvement (#831) Added "@Api" swagger annotation, "nickname" for ApiOperation. Fixed javadock for rest-assured client. --- .../Java/libraries/rest-assured/api.mustache | 20 +++-- .../client/api/AnotherFakeApi.java | 8 +- .../org/openapitools/client/api/FakeApi.java | 90 +++++++++++-------- .../client/api/FakeClassnameTags123Api.java | 8 +- .../org/openapitools/client/api/PetApi.java | 80 +++++++++-------- .../org/openapitools/client/api/StoreApi.java | 37 ++++---- .../org/openapitools/client/api/UserApi.java | 71 ++++++++------- 7 files changed, 178 insertions(+), 136 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache index f536ddf9b49..75c3a373ae3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/api.mustache @@ -28,6 +28,7 @@ import {{invokerPackage}}.JSON; import static io.restassured.http.Method.*; +@Api(value = "{{{baseName}}}") public class {{classname}} { private RequestSpecBuilder reqSpec; @@ -44,10 +45,11 @@ public class {{classname}} { {{#operation}} @ApiOperation(value = "{{{summary}}}", - notes = "{{{notes}}}", - tags={ {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) + notes = "{{{notes}}}", + nickname = "{{{operationId}}}", + tags = { {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} }) @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} }) + @ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} }) {{#isDeprecated}} @Deprecated {{/isDeprecated}} @@ -135,7 +137,7 @@ public class {{classname}} { {{#bodyParams}} /** - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper body({{{dataType}}} {{paramName}}) { @@ -148,7 +150,7 @@ public class {{classname}} { public static final String {{#convert}}{{paramName}}{{/convert}}_HEADER = "{{baseName}}"; /** - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper {{paramName}}Header(String {{paramName}}) { @@ -161,7 +163,7 @@ public class {{classname}} { public static final String {{#convert}}{{paramName}}{{/convert}}_PATH = "{{baseName}}"; /** - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper {{paramName}}Path(Object {{paramName}}) { @@ -174,7 +176,7 @@ public class {{classname}} { public static final String {{#convert}}{{paramName}}{{/convert}}_QUERY = "{{baseName}}"; /** - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper {{paramName}}Query(Object... {{paramName}}) { @@ -188,7 +190,7 @@ public class {{classname}} { public static final String {{#convert}}{{paramName}}{{/convert}}_FORM = "{{baseName}}"; /** - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper {{paramName}}Form(Object... {{paramName}}) { @@ -203,7 +205,7 @@ public class {{classname}} { /** * It will assume that the control name is file and the <content-type> is <application/octet-stream> * @see #reqSpec for customise - * @param {{paramName}} ({{{dataType}}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} * @return operation */ public {{operationIdCamelCase}}Oper {{paramName}}MultiPart({{{dataType}}} {{paramName}}) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 9baed9be21d..0128eed22b5 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -36,6 +36,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "AnotherFake") public class AnotherFakeApi { private RequestSpecBuilder reqSpec; @@ -50,10 +51,11 @@ public class AnotherFakeApi { @ApiOperation(value = "To test special tags", - notes = "To test special tags and operation ID starting with number", - tags={ "$another-fake?" }) + notes = "To test special tags and operation ID starting with number", + nickname = "call123testSpecialTags", + tags = { "$another-fake?" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public Call123testSpecialTagsOper call123testSpecialTags() { return new Call123testSpecialTagsOper(reqSpec); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java index c5a3414f460..250ef18113a 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeApi.java @@ -43,6 +43,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "Fake") public class FakeApi { private RequestSpecBuilder reqSpec; @@ -57,102 +58,113 @@ public class FakeApi { @ApiOperation(value = "", - notes = "Test serialization of outer boolean types", - tags={ "fake" }) + notes = "Test serialization of outer boolean types", + nickname = "fakeOuterBooleanSerialize", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Output boolean") }) + @ApiResponse(code = 200, message = "Output boolean") }) public FakeOuterBooleanSerializeOper fakeOuterBooleanSerialize() { return new FakeOuterBooleanSerializeOper(reqSpec); } @ApiOperation(value = "", - notes = "Test serialization of object with outer number type", - tags={ "fake" }) + notes = "Test serialization of object with outer number type", + nickname = "fakeOuterCompositeSerialize", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Output composite") }) + @ApiResponse(code = 200, message = "Output composite") }) public FakeOuterCompositeSerializeOper fakeOuterCompositeSerialize() { return new FakeOuterCompositeSerializeOper(reqSpec); } @ApiOperation(value = "", - notes = "Test serialization of outer number types", - tags={ "fake" }) + notes = "Test serialization of outer number types", + nickname = "fakeOuterNumberSerialize", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Output number") }) + @ApiResponse(code = 200, message = "Output number") }) public FakeOuterNumberSerializeOper fakeOuterNumberSerialize() { return new FakeOuterNumberSerializeOper(reqSpec); } @ApiOperation(value = "", - notes = "Test serialization of outer string types", - tags={ "fake" }) + notes = "Test serialization of outer string types", + nickname = "fakeOuterStringSerialize", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Output string") }) + @ApiResponse(code = 200, message = "Output string") }) public FakeOuterStringSerializeOper fakeOuterStringSerialize() { return new FakeOuterStringSerializeOper(reqSpec); } @ApiOperation(value = "", - notes = "For this test, the body for this request much reference a schema named `File`.", - tags={ "fake" }) + notes = "For this test, the body for this request much reference a schema named `File`.", + nickname = "testBodyWithFileSchema", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Success") }) + @ApiResponse(code = 200, message = "Success") }) public TestBodyWithFileSchemaOper testBodyWithFileSchema() { return new TestBodyWithFileSchemaOper(reqSpec); } @ApiOperation(value = "", - notes = "", - tags={ "fake" }) + notes = "", + nickname = "testBodyWithQueryParams", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Success") }) + @ApiResponse(code = 200, message = "Success") }) public TestBodyWithQueryParamsOper testBodyWithQueryParams() { return new TestBodyWithQueryParamsOper(reqSpec); } @ApiOperation(value = "To test \"client\" model", - notes = "To test \"client\" model", - tags={ "fake" }) + notes = "To test \"client\" model", + nickname = "testClientModel", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public TestClientModelOper testClientModel() { return new TestClientModelOper(reqSpec); } @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", - notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", - tags={ "fake" }) + notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", + nickname = "testEndpointParameters", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid username supplied") , - @ApiResponse(code = 404, message = "User not found") }) + @ApiResponse(code = 400, message = "Invalid username supplied") , + @ApiResponse(code = 404, message = "User not found") }) public TestEndpointParametersOper testEndpointParameters() { return new TestEndpointParametersOper(reqSpec); } @ApiOperation(value = "To test enum parameters", - notes = "To test enum parameters", - tags={ "fake" }) + notes = "To test enum parameters", + nickname = "testEnumParameters", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid request") , - @ApiResponse(code = 404, message = "Not found") }) + @ApiResponse(code = 400, message = "Invalid request") , + @ApiResponse(code = 404, message = "Not found") }) public TestEnumParametersOper testEnumParameters() { return new TestEnumParametersOper(reqSpec); } @ApiOperation(value = "test inline additionalProperties", - notes = "", - tags={ "fake" }) + notes = "", + nickname = "testInlineAdditionalProperties", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public TestInlineAdditionalPropertiesOper testInlineAdditionalProperties() { return new TestInlineAdditionalPropertiesOper(reqSpec); } @ApiOperation(value = "test json serialization of form data", - notes = "", - tags={ "fake" }) + notes = "", + nickname = "testJsonFormData", + tags = { "fake" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public TestJsonFormDataOper testJsonFormData() { return new TestJsonFormDataOper(reqSpec); } @@ -913,7 +925,7 @@ public class FakeApi { public static final String ENUM_HEADER_STRING_ARRAY_HEADER = "enum_header_string_array"; /** - * @param enumHeaderStringArray (List) Header parameter enum test (string array) (optional) + * @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional) * @return operation */ public TestEnumParametersOper enumHeaderStringArrayHeader(String enumHeaderStringArray) { @@ -935,7 +947,7 @@ public class FakeApi { public static final String ENUM_QUERY_STRING_ARRAY_QUERY = "enum_query_string_array"; /** - * @param enumQueryStringArray (List) Query parameter enum test (string array) (optional) + * @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional) * @return operation */ public TestEnumParametersOper enumQueryStringArrayQuery(Object... enumQueryStringArray) { @@ -979,7 +991,7 @@ public class FakeApi { public static final String ENUM_FORM_STRING_ARRAY_FORM = "enum_form_string_array"; /** - * @param enumFormStringArray (List) Form parameter enum test (string array) (optional, default to $) + * @param enumFormStringArray (List<String>) Form parameter enum test (string array) (optional, default to $) * @return operation */ public TestEnumParametersOper enumFormStringArrayForm(Object... enumFormStringArray) { @@ -1050,7 +1062,7 @@ public class FakeApi { } /** - * @param requestBody (Map) request body (required) + * @param requestBody (Map<String, String>) request body (required) * @return operation */ public TestInlineAdditionalPropertiesOper body(Map requestBody) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 459e77f08ed..beb30b39339 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -36,6 +36,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "FakeClassnameTags123") public class FakeClassnameTags123Api { private RequestSpecBuilder reqSpec; @@ -50,10 +51,11 @@ public class FakeClassnameTags123Api { @ApiOperation(value = "To test class name in snake case", - notes = "To test class name in snake case", - tags={ "fake_classname_tags 123#$%^" }) + notes = "To test class name in snake case", + nickname = "testClassname", + tags = { "fake_classname_tags 123#$%^" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public TestClassnameOper testClassname() { return new TestClassnameOper(reqSpec); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java index f0ed89d9c3f..43e9f070484 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/PetApi.java @@ -38,6 +38,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "Pet") public class PetApi { private RequestSpecBuilder reqSpec; @@ -52,89 +53,98 @@ public class PetApi { @ApiOperation(value = "Add a new pet to the store", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "addPet", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) + @ApiResponse(code = 405, message = "Invalid input") }) public AddPetOper addPet() { return new AddPetOper(reqSpec); } @ApiOperation(value = "Deletes a pet", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "deletePet", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid pet value") }) + @ApiResponse(code = 400, message = "Invalid pet value") }) public DeletePetOper deletePet() { return new DeletePetOper(reqSpec); } @ApiOperation(value = "Finds Pets by status", - notes = "Multiple status values can be provided with comma separated strings", - tags={ "pet" }) + notes = "Multiple status values can be provided with comma separated strings", + nickname = "findPetsByStatus", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid status value") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid status value") }) public FindPetsByStatusOper findPetsByStatus() { return new FindPetsByStatusOper(reqSpec); } @ApiOperation(value = "Finds Pets by tags", - notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - tags={ "pet" }) + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + nickname = "findPetsByTags", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid tag value") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid tag value") }) @Deprecated public FindPetsByTagsOper findPetsByTags() { return new FindPetsByTagsOper(reqSpec); } @ApiOperation(value = "Find pet by ID", - notes = "Returns a single pet", - tags={ "pet" }) + notes = "Returns a single pet", + nickname = "getPetById", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid ID supplied") , - @ApiResponse(code = 404, message = "Pet not found") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid ID supplied") , + @ApiResponse(code = 404, message = "Pet not found") }) public GetPetByIdOper getPetById() { return new GetPetByIdOper(reqSpec); } @ApiOperation(value = "Update an existing pet", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "updatePet", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied") , - @ApiResponse(code = 404, message = "Pet not found") , - @ApiResponse(code = 405, message = "Validation exception") }) + @ApiResponse(code = 400, message = "Invalid ID supplied") , + @ApiResponse(code = 404, message = "Pet not found") , + @ApiResponse(code = 405, message = "Validation exception") }) public UpdatePetOper updatePet() { return new UpdatePetOper(reqSpec); } @ApiOperation(value = "Updates a pet in the store with form data", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "updatePetWithForm", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) + @ApiResponse(code = 405, message = "Invalid input") }) public UpdatePetWithFormOper updatePetWithForm() { return new UpdatePetWithFormOper(reqSpec); } @ApiOperation(value = "uploads an image", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "uploadFile", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public UploadFileOper uploadFile() { return new UploadFileOper(reqSpec); } @ApiOperation(value = "uploads an image (required)", - notes = "", - tags={ "pet" }) + notes = "", + nickname = "uploadFileWithRequiredFile", + tags = { "pet" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public UploadFileWithRequiredFileOper uploadFileWithRequiredFile() { return new UploadFileWithRequiredFileOper(reqSpec); } @@ -326,7 +336,7 @@ public class PetApi { public static final String STATUS_QUERY = "status"; /** - * @param status (List) Status values that need to be considered for filter (required) + * @param status (List<String>) Status values that need to be considered for filter (required) * @return operation */ public FindPetsByStatusOper statusQuery(Object... status) { @@ -400,7 +410,7 @@ public class PetApi { public static final String TAGS_QUERY = "tags"; /** - * @param tags (List) Tags to filter by (required) + * @param tags (List<String>) Tags to filter by (required) * @return operation */ public FindPetsByTagsOper tagsQuery(Object... tags) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java index 03a4d5587f9..3db2be24e47 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/StoreApi.java @@ -36,6 +36,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "Store") public class StoreApi { private RequestSpecBuilder reqSpec; @@ -50,41 +51,45 @@ public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", - notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - tags={ "store" }) + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + nickname = "deleteOrder", + tags = { "store" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied") , - @ApiResponse(code = 404, message = "Order not found") }) + @ApiResponse(code = 400, message = "Invalid ID supplied") , + @ApiResponse(code = 404, message = "Order not found") }) public DeleteOrderOper deleteOrder() { return new DeleteOrderOper(reqSpec); } @ApiOperation(value = "Returns pet inventories by status", - notes = "Returns a map of status codes to quantities", - tags={ "store" }) + notes = "Returns a map of status codes to quantities", + nickname = "getInventory", + tags = { "store" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) + @ApiResponse(code = 200, message = "successful operation") }) public GetInventoryOper getInventory() { return new GetInventoryOper(reqSpec); } @ApiOperation(value = "Find purchase order by ID", - notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - tags={ "store" }) + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + nickname = "getOrderById", + tags = { "store" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid ID supplied") , - @ApiResponse(code = 404, message = "Order not found") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid ID supplied") , + @ApiResponse(code = 404, message = "Order not found") }) public GetOrderByIdOper getOrderById() { return new GetOrderByIdOper(reqSpec); } @ApiOperation(value = "Place an order for a pet", - notes = "", - tags={ "store" }) + notes = "", + nickname = "placeOrder", + tags = { "store" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid Order") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid Order") }) public PlaceOrderOper placeOrder() { return new PlaceOrderOper(reqSpec); } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java index de5aa794f07..ccbc21769a4 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java @@ -36,6 +36,7 @@ import org.openapitools.client.JSON; import static io.restassured.http.Method.*; +@Api(value = "User") public class UserApi { private RequestSpecBuilder reqSpec; @@ -50,78 +51,86 @@ public class UserApi { @ApiOperation(value = "Create user", - notes = "This can only be done by the logged in user.", - tags={ "user" }) + notes = "This can only be done by the logged in user.", + nickname = "createUser", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 0, message = "successful operation") }) public CreateUserOper createUser() { return new CreateUserOper(reqSpec); } @ApiOperation(value = "Creates list of users with given input array", - notes = "", - tags={ "user" }) + notes = "", + nickname = "createUsersWithArrayInput", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 0, message = "successful operation") }) public CreateUsersWithArrayInputOper createUsersWithArrayInput() { return new CreateUsersWithArrayInputOper(reqSpec); } @ApiOperation(value = "Creates list of users with given input array", - notes = "", - tags={ "user" }) + notes = "", + nickname = "createUsersWithListInput", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 0, message = "successful operation") }) public CreateUsersWithListInputOper createUsersWithListInput() { return new CreateUsersWithListInputOper(reqSpec); } @ApiOperation(value = "Delete user", - notes = "This can only be done by the logged in user.", - tags={ "user" }) + notes = "This can only be done by the logged in user.", + nickname = "deleteUser", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid username supplied") , - @ApiResponse(code = 404, message = "User not found") }) + @ApiResponse(code = 400, message = "Invalid username supplied") , + @ApiResponse(code = 404, message = "User not found") }) public DeleteUserOper deleteUser() { return new DeleteUserOper(reqSpec); } @ApiOperation(value = "Get user by user name", - notes = "", - tags={ "user" }) + notes = "", + nickname = "getUserByName", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid username supplied") , - @ApiResponse(code = 404, message = "User not found") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid username supplied") , + @ApiResponse(code = 404, message = "User not found") }) public GetUserByNameOper getUserByName() { return new GetUserByNameOper(reqSpec); } @ApiOperation(value = "Logs user into the system", - notes = "", - tags={ "user" }) + notes = "", + nickname = "loginUser", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") , - @ApiResponse(code = 400, message = "Invalid username/password supplied") }) + @ApiResponse(code = 200, message = "successful operation") , + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) public LoginUserOper loginUser() { return new LoginUserOper(reqSpec); } @ApiOperation(value = "Logs out current logged in user session", - notes = "", - tags={ "user" }) + notes = "", + nickname = "logoutUser", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 0, message = "successful operation") }) + @ApiResponse(code = 0, message = "successful operation") }) public LogoutUserOper logoutUser() { return new LogoutUserOper(reqSpec); } @ApiOperation(value = "Updated user", - notes = "This can only be done by the logged in user.", - tags={ "user" }) + notes = "This can only be done by the logged in user.", + nickname = "updateUser", + tags = { "user" }) @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid user supplied") , - @ApiResponse(code = 404, message = "User not found") }) + @ApiResponse(code = 400, message = "Invalid user supplied") , + @ApiResponse(code = 404, message = "User not found") }) public UpdateUserOper updateUser() { return new UpdateUserOper(reqSpec); } @@ -228,7 +237,7 @@ public class UserApi { } /** - * @param user (List) List of user object (required) + * @param user (List<User>) List of user object (required) * @return operation */ public CreateUsersWithArrayInputOper body(List user) { @@ -288,7 +297,7 @@ public class UserApi { } /** - * @param user (List) List of user object (required) + * @param user (List<User>) List of user object (required) * @return operation */ public CreateUsersWithListInputOper body(List user) { From d593988e5dfc101527ccde6aee314aab5bba17b8 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 19 Aug 2018 14:52:21 +0800 Subject: [PATCH 06/37] fix erlang optiona/required parameters (#829) --- .../languages/ErlangClientCodegen.java | 3 + .../codegen/mustache/JoinWithCommaLambda.java | 59 +++++++++++++++++++ .../main/resources/erlang-client/api.mustache | 6 +- .../erlang-client/.openapi-generator/VERSION | 2 +- 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/JoinWithCommaLambda.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java index 631c93e2b6e..5ba57db31e1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java @@ -21,6 +21,7 @@ import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; import org.openapitools.codegen.*; +import org.openapitools.codegen.mustache.JoinWithCommaLambda; import io.swagger.v3.oas.models.media.*; import java.io.File; @@ -133,6 +134,8 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig public void processOpts() { super.processOpts(); + additionalProperties.put("joinWithComma", new JoinWithCommaLambda()); + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); } else { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/JoinWithCommaLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/JoinWithCommaLambda.java new file mode 100644 index 00000000000..80944554940 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/JoinWithCommaLambda.java @@ -0,0 +1,59 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.mustache; + +import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.DefaultCodegen; + +import java.io.IOException; +import java.io.Writer; + +/** + * Split text by 2 spaces and then join the strings with ", " + * + * Register: + *
+ * additionalProperties.put("joinWithComma", new JoinWithCommaLambda());
+ * 
+ * + * Use: + *
+ * {{#joinWithComma}}{{name}}{{/joinWithComma}}
+ * 
+ */ +public class JoinWithCommaLambda implements Mustache.Lambda { + private CodegenConfig generator = null; + + public JoinWithCommaLambda() { + + } + + public JoinWithCommaLambda generator(final CodegenConfig generator) { + this.generator = generator; + return this; + } + + @Override + public void execute(Template.Fragment fragment, Writer writer) throws IOException { + String[] substr = fragment.execute().trim().split(" "); + + writer.write(String.join(", ", substr)); + } +} diff --git a/modules/openapi-generator/src/main/resources/erlang-client/api.mustache b/modules/openapi-generator/src/main/resources/erlang-client/api.mustache index c292cf28aa3..a2335745bbb 100644 --- a/modules/openapi-generator/src/main/resources/erlang-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/erlang-client/api.mustache @@ -22,9 +22,9 @@ Method = {{httpMethod}}, Path = ["{{{replacedPathName}}}"], - QS = {{#queryParams.isEmpty}}[]{{/queryParams.isEmpty}}{{^queryParams.isEmpty}}lists:flatten([{{#queryParams}}{{#required}}{{^-first}}, {{/-first}}{{#qsEncode}}{{this}}{{/qsEncode}}{{/required}}{{/queryParams}}])++{{packageName}}_utils:optional_params([{{#queryParams}}{{^required}}{{^-first}}, {{/-first}}'{{baseName}}'{{/required}}{{/queryParams}}], _OptionalParams){{/queryParams.isEmpty}}, - Headers = {{#headerParams.isEmpty}}[]{{/headerParams.isEmpty}}{{^headerParams.isEmpty}}[{{#headerParams}}{{#required}}{{^-first}}, {{/-first}}{<<"{{baseName}}">>, {{paramName}}}{{/required}}{{/headerParams}}]++{{packageName}}_utils:optional_params([{{#headerParams}}{{^required}}{{^-first}}, {{/-first}}'{{baseName}}'{{/required}}{{/headerParams}}], _OptionalParams){{/headerParams.isEmpty}}, - Body1 = {{^formParams.isEmpty}}{form, [{{#formParams}}{{#required}}{{^-first}}, {{/-first}}{<<"{{baseName}}">>, {{paramName}}}{{/required}}{{/formParams}}]++{{packageName}}_utils:optional_params([{{#formParams}}{{^required}}{{^-first}}, {{/-first}}'{{baseName}}'{{/required}}{{/formParams}}], _OptionalParams)}{{/formParams.isEmpty}}{{#formParams.isEmpty}}{{#bodyParams.isEmpty}}[]{{/bodyParams.isEmpty}}{{^bodyParams.isEmpty}}{{#bodyParams}}{{paramName}}{{/bodyParams}}{{/bodyParams.isEmpty}}{{/formParams.isEmpty}}, + QS = {{#queryParams.isEmpty}}[]{{/queryParams.isEmpty}}{{^queryParams.isEmpty}}lists:flatten([{{#joinWithComma}}{{#queryParams}}{{#required}}{{#qsEncode}}{{this}}{{/qsEncode}} {{/required}}{{/queryParams}}{{/joinWithComma}}])++{{packageName}}_utils:optional_params([{{#joinWithComma}}{{#queryParams}}{{^required}} '{{baseName}}'{{/required}}{{/queryParams}}{{/joinWithComma}}], _OptionalParams){{/queryParams.isEmpty}}, + Headers = {{#headerParams.isEmpty}}[]{{/headerParams.isEmpty}}{{^headerParams.isEmpty}}[{{#headerParams}}{{#required}} {<<"{{baseName}}">>, {{paramName}}}{{/required}}{{/headerParams}}]++{{packageName}}_utils:optional_params([{{#joinWithComma}}{{#headerParams}}{{^required}} '{{baseName}}'{{/required}}{{/headerParams}}{{/joinWithComma}}], _OptionalParams){{/headerParams.isEmpty}}, + Body1 = {{^formParams.isEmpty}}{form, [{{#joinWithComma}}{{#formParams}}{{#required}} {<<"{{baseName}}">>, {{paramName}}}{{/required}}{{/formParams}}{{/joinWithComma}}]++{{packageName}}_utils:optional_params([{{#joinWithComma}}{{#formParams}}{{^required}} '{{baseName}}'{{/required}}{{/formParams}}{{/joinWithComma}}], _OptionalParams)}{{/formParams.isEmpty}}{{#formParams.isEmpty}}{{#bodyParams.isEmpty}}[]{{/bodyParams.isEmpty}}{{^bodyParams.isEmpty}}{{#bodyParams}}{{paramName}}{{/bodyParams}}{{/bodyParams.isEmpty}}{{/formParams.isEmpty}}, ContentTypeHeader = {{packageName}}_utils:select_header_content_type([{{#consumes}}{{^-first}}, {{/-first}}<<"{{mediaType}}">>{{/consumes}}]), Opts = maps:get(hackney_opts, Optional, []), diff --git a/samples/client/petstore/erlang-client/.openapi-generator/VERSION b/samples/client/petstore/erlang-client/.openapi-generator/VERSION index 096bf47efe3..105bb87d77b 100644 --- a/samples/client/petstore/erlang-client/.openapi-generator/VERSION +++ b/samples/client/petstore/erlang-client/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.2-SNAPSHOT \ No newline at end of file From 3b9de3baa3d6da136039cc0249451c33631e647c Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Sun, 19 Aug 2018 11:45:55 +0200 Subject: [PATCH 07/37] Added server variable support (#816) * Added server variable support * Replaced tabs with 4 spaces --- .../openapitools/codegen/CodegenConfig.java | 6 +++ .../openapitools/codegen/CodegenServer.java | 9 +++++ .../codegen/CodegenServerVariable.java | 10 +++++ .../openapitools/codegen/DefaultCodegen.java | 37 +++++++++++++++++++ .../codegen/DefaultGenerator.java | 6 +++ .../codegen/utils/URLPathUtils.java | 2 +- 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index e91d00d4ce3..61b98db1bef 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -23,6 +23,8 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import io.swagger.v3.oas.models.servers.ServerVariable; import java.util.List; import java.util.Map; @@ -113,6 +115,10 @@ public interface CodegenConfig { List fromSecurity(Map schemas); + List fromServers(List servers); + + List fromServerVariables(Map variables); + Set defaultIncludes(); Map typeMapping(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java new file mode 100644 index 00000000000..0708d4407fc --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServer.java @@ -0,0 +1,9 @@ +package org.openapitools.codegen; + +import java.util.List; + +public class CodegenServer { + public String url; + public String description; + public List variables; +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java new file mode 100644 index 00000000000..15e9db55b67 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenServerVariable.java @@ -0,0 +1,10 @@ +package org.openapitools.codegen; + +import java.util.List; + +public class CodegenServerVariable { + public String name; + public String defaultValue; + public String description; + public List enumValues; +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 46790890a85..8e1b5ea349b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -43,6 +43,8 @@ import io.swagger.v3.oas.models.responses.ApiResponses; import io.swagger.v3.oas.models.security.OAuthFlow; import io.swagger.v3.oas.models.security.OAuthFlows; import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import io.swagger.v3.oas.models.servers.ServerVariable; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.lang3.ObjectUtils; @@ -64,6 +66,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -4588,4 +4591,38 @@ public class DefaultCodegen implements CodegenConfig { public boolean isDataTypeString(String dataType) { return "String".equals(dataType); } + + @Override + public List fromServers(List servers) { + if (servers == null) { + return Collections.emptyList(); + } + List codegenServers = new LinkedList<>(); + for (Server server: servers) { + CodegenServer cs = new CodegenServer(); + cs.description = server.getDescription(); + cs.url = server.getUrl(); + cs.variables = this.fromServerVariables(server.getVariables()); + codegenServers.add(cs); + } + return codegenServers; + } + + @Override + public List fromServerVariables(Map variables) { + if (variables == null) { + return Collections.emptyList(); + } + List codegenServerVariables = new LinkedList<>(); + for (Entry variableEntry: variables.entrySet()) { + CodegenServerVariable codegenServerVariable = new CodegenServerVariable(); + ServerVariable variable = variableEntry.getValue(); + codegenServerVariable.defaultValue = variable.getDefault(); + codegenServerVariable.description = variable.getDescription(); + codegenServerVariable.enumValues = variable.getEnum(); + codegenServerVariable.name = variableEntry.getKey(); + codegenServerVariables.add(codegenServerVariable); + } + return codegenServerVariables; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index b583079e0ff..71e90105422 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -762,6 +762,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { bundle.put("authMethods", authMethods); bundle.put("hasAuthMethods", true); } + + List servers = config.fromServers(openAPI.getServers()); + if (servers != null && !servers.isEmpty()) { + bundle.put("servers", servers); + bundle.put("hasServers", true); + } if (openAPI.getExternalDocs() != null) { bundle.put("externalDocs", openAPI.getExternalDocs()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java index 91aba80d82c..fdfa6fdfd6b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java @@ -50,7 +50,7 @@ public class URLPathUtils { return getServerURL(servers.get(0)); } - static URL getServerURL(final Server server) { + public static URL getServerURL(final Server server) { String url = server.getUrl(); ServerVariables variables = server.getVariables(); if(variables == null) { From 62dfb749f1530a09327cb70a7eddd01f94e7d284 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Sun, 19 Aug 2018 16:17:26 -0400 Subject: [PATCH 08/37] [gradle-plugin] README notes on multiple specs (#847) A user asked about how one would approach generating code from multiple specifications. Adding this information to the README, as it seems others would find the information helpful. Also explaining how to use tasks from this plugin as this may not be commonly known or intuitive beahvior. --- .../README.adoc | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index ba0eb6dab25..4090a03e88a 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -2,6 +2,9 @@ This document describes the gradle plugin for OpenAPI Generator. +This gradle plugin offers a declarative DSL via _extensions_ (these are Gradle project extensions). +These map almost fully 1:1 with the options you'd pass to the CLI or Maven plugin. The plugin maps the extensions to a task of the same name to provide a clean API. If you're interested in the extension/task mapping concept from a high-level, you can https://docs.gradle.org/current/userguide/custom_plugins.html#sec:mapping_extension_properties_to_task_properties[check out Gradle's docs]. + == Tasks Tasks are listed under the "OpenAPI Tools" tasks heading. @@ -24,6 +27,17 @@ Tasks are listed under the "OpenAPI Tools" tasks heading. |Validates an Open API 2.0 or 3.x specification document. |=== + +[NOTE] +==== +The plugin implements the above tasks as project extensions of the same name. If you'd like to declare +these tasks as dependencies to other tasks (using `dependsOn`), you'll need a task reference. e.g.: + +``` +compileJava.dependsOn tasks.openApiGenerate +``` +==== + == Plugin Setup [source,groovy] @@ -455,3 +469,65 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug ---- $ ./gradlew openApiValidate --input=/Users/jim/projects/openapi-generator/modules/openapi-generator/src/test/resources/3_0/petstore.yaml ---- + +=== Generate multiple sources + +If you want to perform multiple generation tasks, you'd want to create a task that inherits from the `GenerateTask`. +Examples can be found in https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle[samples/local-spec/build.gradle]. + +To match the example you are using for that old swagger based plugin: + +```gradle +task buildGoClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){ + generatorName = "go" + inputSpec = "$rootDir/petstore-v3.0.yaml".toString() + additionalProperties = [ + packageName: "petstore" + ] + outputDir = "$buildDir/go".toString() + configOptions = [ + dateLibrary: "threetenp" + ] +} +task buildKotlinClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){ + generatorName = "kotlin" + inputSpec = "$rootDir/petstore-v3.0.yaml".toString() + outputDir = "$buildDir/kotlin".toString() + apiPackage = "org.openapitools.example.api" + invokerPackage = "org.openapitools.example.invoker" + modelPackage = "org.openapitools.example.model" + configOptions = [ + dateLibrary: "java8" + ] + systemProperties = [ + modelDocs: "false" + ] +} +``` + +To execute your specs, you'd then do: + +``` +./gradlew buildGoClient buildKotlinClient +``` + +If you want to simplify the execution, you could create a new task with `dependsOn`. + +```gradle +task codegen(dependsOn: ['buildGoClient', 'buildKotlinClient']) +``` + +Or, if you're generating the code on compile, you can add these as a dependency to `compileJava` or any other existing task: + + +```gradle +compileJava.dependsOn buildKotlinClient, tasks.openApiGenerate +``` + +[NOTE] +==== +`openApiGenerate` is a project extension _and_ a task. If you want to use this in `dependsOn`, +you need a task reference or instance. One way to do this is to access it as `tasks.openApiGenerate`. + +You can run `gradle tasks --debug` to see this registration. +==== From bd7c9e30d323a6b7c78c2e64de917f39f9fbca39 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Mon, 20 Aug 2018 02:33:49 +0100 Subject: [PATCH 09/37] [cli] Don't log to STDOUT if debug flags are set (#474) It makes sense that error messages should be written to STDERR and all others should be written to STDOUT (as shown in #207). However, it would be convenient to parse the debugging output when the relevant flags are set. This change will disable logging to STDOUT and redirect all log messages to STDERR when any of the debug flags are set. (Resolves #473) --- .../org/openapitools/codegen/cmd/Generate.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index 8c4db2af9e4..ae3613c41a9 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -17,6 +17,8 @@ package org.openapitools.codegen.cmd; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.core.spi.FilterAttachable; import io.airlift.airline.Command; import io.airlift.airline.Option; import org.openapitools.codegen.ClientOptInput; @@ -32,6 +34,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty; import java.util.ArrayList; import java.util.List; +import java.util.stream.Stream; /** * User: lanwen Date: 24.03.15 Time: 20:22 @@ -199,8 +202,23 @@ public class Generate implements Runnable { description = "Skips the default behavior of validating an input specification.") private Boolean skipValidateSpec; + @Option(name = {"--log-to-stderr"}, + title = "Log to STDERR", + description = "write all log messages (not just errors) to STDOUT." + + " Useful for piping the JSON output of debug options (e.g. `-DdebugOperations`) to an external parser directly while testing a generator.") + private Boolean logToStderr; + @Override public void run() { + if (logToStderr != null) { + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + Stream.of(Logger.ROOT_LOGGER_NAME, "io.swagger", "org.openapitools") + .map(lc::getLogger) + .peek(logger -> logger.detachAppender("STDOUT")) + .reduce((logger, next) -> logger.getName().equals(Logger.ROOT_LOGGER_NAME) ? logger : next) + .map(root -> root.getAppender("STDERR")) + .ifPresent(FilterAttachable::clearAllFilters); + } // attempt to read from config file CodegenConfigurator configurator = CodegenConfigurator.fromFile(configFile); From a3e5edc367946111f224af83378f4e91627ea973 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Sun, 19 Aug 2018 21:37:20 -0400 Subject: [PATCH 10/37] :memo: Updating 'help generate' switches in README Adds new --log-to-stderr as well as a missed option for --skip-validate-spec. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45f98af8552..dfbb92f2857 100644 --- a/README.md +++ b/README.md @@ -406,13 +406,14 @@ SYNOPSIS [--invoker-package ] [(-l | --lang )] [--language-specific-primitives ...] - [--library ] [--model-name-prefix ] + [--library ] [--log-to-stderr] + [--model-name-prefix ] [--model-name-suffix ] [--model-package ] [(-o | --output )] [--release-note ] [--remove-operation-id-prefix] [--reserved-words-mappings ...] - [(-s | --skip-overwrite)] + [(-s | --skip-overwrite)] [--skip-validate-spec] [(-t