diff --git a/bin/configs/cpp-restsdk-client.yaml b/bin/configs/cpp-restsdk-client.yaml
index fedc628a69e..ccd23932b49 100644
--- a/bin/configs/cpp-restsdk-client.yaml
+++ b/bin/configs/cpp-restsdk-client.yaml
@@ -1,6 +1,6 @@
generatorName: cpp-restsdk
outputDir: samples/client/petstore/cpp-restsdk/client
-inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client
additionalProperties:
packageName: CppRestPetstoreClient
diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml
new file mode 100644
index 00000000000..a8f9809a124
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml
@@ -0,0 +1,741 @@
+openapi: 3.0.0
+servers:
+ - url: 'http://petstore.swagger.io/v2'
+info:
+ description: >-
+ This is a sample server Petstore server. For this sample, you can use the api key
+ `special-key` to test the authorization filters.
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+paths:
+ /pet:
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ externalDocs:
+ url: "http://petstore.swagger.io/v2/doc/updatePet"
+ description: "API documentation for the updatePet operation"
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ style: form
+ explode: false
+ deprecated: true
+ schema:
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'read:pets'
+ deprecated: true
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ type: string
+ format: binary
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid Order
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+ '/store/order/{orderId}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions
+ operationId: getOrderById
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ minimum: 1
+ maximum: 5
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ schema:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ Set-Cookie:
+ description: >-
+ Cookie authentication key for use with the `api_key`
+ apiKey authentication.
+ schema:
+ type: string
+ example: AUTH_KEY=abcde12345; Path=/; HttpOnly
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ responses:
+ default:
+ description: successful operation
+ security:
+ - api_key: []
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be fetched. Use user1 for testing.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ security:
+ - api_key: []
+externalDocs:
+ description: Find out more about Swagger
+ url: 'http://swagger.io'
+components:
+ requestBodies:
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ required: true
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+ schemas:
+ Order:
+ title: Pet Order
+ description: An order for a pets from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+ Category:
+ title: Pet category
+ description: A category for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
+ xml:
+ name: Category
+ User:
+ title: a User
+ description: A User who is purchasing from the pet store
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+ Tag:
+ title: Pet Tag
+ description: A tag for a pet
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+ Pet:
+ title: a Pet
+ description: A pet for sale in the pet store
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ category:
+ $ref: '#/components/schemas/Category'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+ status:
+ type: string
+ description: pet status in the store
+ deprecated: true
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
+ ApiResponse:
+ title: An uploaded response
+ description: Describes the result of uploading an image resource
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
index acf70da46d3..275bda18c47 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
@@ -52,9 +52,9 @@ public:
///
///
///
- /// Pet object that needs to be added to the store
- pplx::task addPet(
- std::shared_ptr body
+ /// Pet object that needs to be added to the store
+ pplx::task> addPet(
+ std::shared_ptr pet
) const;
///
/// Deletes a pet
@@ -104,9 +104,9 @@ public:
///
///
///
- /// Pet object that needs to be added to the store
- pplx::task updatePet(
- std::shared_ptr body
+ /// Pet object that needs to be added to the store
+ pplx::task> updatePet(
+ std::shared_ptr pet
) const;
///
/// Updates a pet in the store with form data
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
index db0f8e55fce..e030a86d67e 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
@@ -78,9 +78,9 @@ public:
///
///
///
- /// order placed for purchasing the pet
+ /// order placed for purchasing the pet
pplx::task> placeOrder(
- std::shared_ptr body
+ std::shared_ptr order
) const;
protected:
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
index c8189772f6f..9e0c7b544f9 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
@@ -50,9 +50,9 @@ public:
///
/// This can only be done by the logged in user.
///
- /// Created user object
+ /// Created user object
pplx::task createUser(
- std::shared_ptr body
+ std::shared_ptr user
) const;
///
/// Creates list of users with given input array
@@ -60,9 +60,9 @@ public:
///
///
///
- /// List of user object
+ /// List of user object
pplx::task createUsersWithArrayInput(
- std::vector> body
+ std::vector> user
) const;
///
/// Creates list of users with given input array
@@ -70,9 +70,9 @@ public:
///
///
///
- /// List of user object
+ /// List of user object
pplx::task createUsersWithListInput(
- std::vector> body
+ std::vector> user
) const;
///
/// Delete user
@@ -121,10 +121,10 @@ public:
/// This can only be done by the logged in user.
///
/// name that need to be deleted
- /// Updated user object
+ /// Updated user object
pplx::task updateUser(
utility::string_t username,
- std::shared_ptr body
+ std::shared_ptr user
) const;
protected:
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
index 430eb99771c..ff8a1b23ad8 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
@@ -35,13 +35,13 @@ PetApi::~PetApi()
{
}
-pplx::task PetApi::addPet(std::shared_ptr body) const
+pplx::task> PetApi::addPet(std::shared_ptr pet) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'pet' is set
+ if (pet == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->addPet"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->addPet"));
}
@@ -54,6 +54,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
std::map> localVarFileParams;
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 localVarResponseHttpContentType;
@@ -93,7 +95,7 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -104,9 +106,9 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(pet.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
}
@@ -161,7 +163,25 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
})
.then([=](utility::string_t localVarResponse)
{
- return void();
+ std::shared_ptr localVarResult(new Pet());
+
+ if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
+ {
+ web::json::value localVarJson = web::json::value::parse(localVarResponse);
+
+ ModelBase::fromJson(localVarJson, localVarResult);
+ }
+ // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
+ // {
+ // TODO multipart response parsing
+ // }
+ else
+ {
+ throw ApiException(500
+ , utility::conversions::to_string_t("error calling addPet: unsupported response type"));
+ }
+
+ return localVarResult;
});
}
pplx::task PetApi::deletePet(int64_t petId, boost::optional apiKey) const
@@ -670,13 +690,13 @@ pplx::task> PetApi::getPetById(int64_t petId) const
return localVarResult;
});
}
-pplx::task PetApi::updatePet(std::shared_ptr body) const
+pplx::task> PetApi::updatePet(std::shared_ptr pet) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'pet' is set
+ if (pet == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->updatePet"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->updatePet"));
}
@@ -689,6 +709,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
std::map> localVarFileParams;
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 localVarResponseHttpContentType;
@@ -728,7 +750,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -739,9 +761,9 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(pet.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
}
@@ -796,7 +818,25 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
})
.then([=](utility::string_t localVarResponse)
{
- return void();
+ std::shared_ptr localVarResult(new Pet());
+
+ if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
+ {
+ web::json::value localVarJson = web::json::value::parse(localVarResponse);
+
+ ModelBase::fromJson(localVarJson, localVarResult);
+ }
+ // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
+ // {
+ // TODO multipart response parsing
+ // }
+ else
+ {
+ throw ApiException(500
+ , utility::conversions::to_string_t("error calling updatePet: unsupported response type"));
+ }
+
+ return localVarResult;
});
}
pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optional name, boost::optional status) const
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
index 25617af00ac..c7608091749 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
@@ -398,13 +398,13 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) const
return localVarResult;
});
}
-pplx::task> StoreApi::placeOrder(std::shared_ptr body) const
+pplx::task> StoreApi::placeOrder(std::shared_ptr order) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'order' is set
+ if (order == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling StoreApi->placeOrder"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'order' when calling StoreApi->placeOrder"));
}
@@ -445,6 +445,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -456,7 +457,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(order);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -467,9 +468,9 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(order.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ order->toMultipart(localVarMultipart, utility::conversions::to_string_t("order"));
}
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
index 398620a7238..d877c40a70d 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
@@ -35,13 +35,13 @@ UserApi::~UserApi()
{
}
-pplx::task UserApi::createUser(std::shared_ptr body) const
+pplx::task UserApi::createUser(std::shared_ptr user) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'user' is set
+ if (user == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling UserApi->createUser"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'user' when calling UserApi->createUser"));
}
@@ -80,6 +80,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -91,7 +92,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(user);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -102,9 +103,9 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(user.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user"));
}
@@ -120,6 +121,14 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
throw ApiException(415, utility::conversions::to_string_t("UserApi->createUser does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -160,7 +169,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
return void();
});
}
-pplx::task UserApi::createUsersWithArrayInput(std::vector> body) const
+pplx::task UserApi::createUsersWithArrayInput(std::vector> user) const
{
@@ -199,6 +208,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -212,7 +222,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@@ -230,11 +240,11 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back(ModelBase::toJson(localVarItem));
}
- localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
+ localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
}
@@ -250,6 +260,14 @@ pplx::task UserApi::createUsersWithArrayInput(std::vectorcreateUsersWithArrayInput does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -290,7 +308,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector UserApi::createUsersWithListInput(std::vector> body) const
+pplx::task UserApi::createUsersWithListInput(std::vector> user) const
{
@@ -329,6 +347,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -342,7 +361,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@@ -360,11 +379,11 @@ pplx::task UserApi::createUsersWithListInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back(ModelBase::toJson(localVarItem));
}
- localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
+ localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
}
@@ -380,6 +399,14 @@ pplx::task UserApi::createUsersWithListInput(std::vectorcreateUsersWithListInput does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -484,6 +511,14 @@ pplx::task UserApi::deleteUser(utility::string_t username) const
throw ApiException(415, utility::conversions::to_string_t("UserApi->deleteUser does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -849,6 +884,14 @@ pplx::task UserApi::logoutUser() const
throw ApiException(415, utility::conversions::to_string_t("UserApi->logoutUser does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -889,13 +932,13 @@ pplx::task UserApi::logoutUser() const
return void();
});
}
-pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr body) const
+pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr user) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'user' is set
+ if (user == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling UserApi->updateUser"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'user' when calling UserApi->updateUser"));
}
@@ -935,6 +978,7 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -946,7 +990,7 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(user);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -957,9 +1001,9 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(user.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user"));
}
@@ -975,6 +1019,14 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr
throw ApiException(415, utility::conversions::to_string_t("UserApi->updateUser does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)