[Cpprest] Fixing issue #3773 (#3876)

* Fixed errors with cpprest client generation when generating a client that uses arrays of primitive types (vector) and file responses (HttpContent).

* Updated the petstore sample using script.

* Removed debug code.

* Removed extra newline to match master.

* Fixed binary file handling in cpprest. Updated petstore samples.

* Update readme to add Cummins to list

* Cleaning up for pull. Removing unnecessary changes.

* Fixing petstore

* Fixing error in build.

* Fixed error in stream copy for binary data

* Replaced tab with 4 spaces in all modified files.

Replaced tab with 4 spaces in all modified files.
This commit is contained in:
Scott Richter
2016-09-29 22:31:24 -04:00
committed by wing328
parent 3d231e4e4b
commit b2e2643fd2
36 changed files with 290 additions and 308 deletions

View File

@@ -1,9 +1,9 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Contact: apiteam@wordnik.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -51,12 +51,6 @@ UserApi::~UserApi()
pplx::task<void> UserApi::createUser(std::shared_ptr<User> body)
{
// verify the required parameter 'body' is set
if (body == nullptr)
{
throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->createUser"));
}
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
utility::string_t path = U("/user");
@@ -67,8 +61,8 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body)
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -82,7 +76,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->createUser does not produce any supported media type"));
}
@@ -146,7 +140,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -157,8 +151,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -178,8 +172,8 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -193,7 +187,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->createUsersWithArrayInput does not produce any supported media type"));
}
@@ -271,7 +265,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -282,8 +276,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -303,8 +297,8 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -318,7 +312,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->createUsersWithListInput does not produce any supported media type"));
}
@@ -396,7 +390,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -407,8 +401,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -429,8 +423,8 @@ pplx::task<void> UserApi::deleteUser(utility::string_t username)
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -444,7 +438,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->deleteUser does not produce any supported media type"));
}
@@ -495,7 +489,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -506,8 +500,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -528,8 +522,8 @@ pplx::task<std::shared_ptr<User>> UserApi::getUserByName(utility::string_t usern
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -543,7 +537,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->getUserByName does not produce any supported media type"));
}
@@ -594,7 +588,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -605,8 +599,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -644,8 +638,8 @@ pplx::task<utility::string_t> UserApi::loginUser(utility::string_t username, uti
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -659,7 +653,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->loginUser does not produce any supported media type"));
}
@@ -716,7 +710,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -727,8 +721,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -767,8 +761,8 @@ pplx::task<void> UserApi::logoutUser()
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -782,7 +776,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->logoutUser does not produce any supported media type"));
}
@@ -829,7 +823,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -840,8 +834,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{
@@ -851,12 +845,6 @@ responseHttpContentTypes.insert( U("application/json") );
pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr<User> body)
{
// verify the required parameter 'body' is set
if (body == nullptr)
{
throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->updateUser"));
}
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
utility::string_t path = U("/user/{username}");
@@ -868,8 +856,8 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
std::map<utility::string_t, std::shared_ptr<HttpContent>> fileParams;
std::unordered_set<utility::string_t> responseHttpContentTypes;
responseHttpContentTypes.insert( U("application/xml") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/json") );
responseHttpContentTypes.insert( U("application/xml") );
utility::string_t responseHttpContentType;
@@ -883,7 +871,7 @@ responseHttpContentTypes.insert( U("application/json") );
{
responseHttpContentType = U("multipart/form-data");
}
else
else
{
throw ApiException(400, U("UserApi->updateUser does not produce any supported media type"));
}
@@ -951,7 +939,7 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
// check response content type
// check response content type
if(response.headers().has(U("Content-Type")))
{
utility::string_t contentType = response.headers()[U("Content-Type")];
@@ -962,8 +950,8 @@ responseHttpContentTypes.insert( U("application/json") );
, std::make_shared<std::stringstream>(response.extract_utf8string(true).get()));
}
}
return response.extract_string();
return response.extract_string();
})
.then([=](utility::string_t response)
{