mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 04:47:08 +00:00
[cpprest] Add support for nested vectors (#7820)
* Small fixes to prevent crash when empty json body is provided. * cpprest : Add toJson and toHttpContent array support. * petstore : Run script. * cpprest : Fix toHttpContent function header. * petstore : Run script. * cpprest : Add support for primitive response without enclosing item. * cpprest : Fix spaces. * cpprest : Fix build if bodyParam is optional. * cpprest : Fix vector of vector param. * Small updates to use utf encoding Add * operator for ^required
This commit is contained in:
committed by
William Cheng
parent
3b7230b170
commit
73bd24db7d
@@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.4.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
@@ -95,6 +95,7 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body)
|
||||
web::json::value json;
|
||||
|
||||
json = ModelBase::toJson(body);
|
||||
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
}
|
||||
@@ -103,7 +104,8 @@ pplx::task<void> UserApi::createUser(std::shared_ptr<User> body)
|
||||
{
|
||||
requestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
|
||||
std::shared_ptr<MultipartFormData> multipart(new MultipartFormData);
|
||||
if(body.get())
|
||||
|
||||
if(body.get())
|
||||
{
|
||||
body->toMultipart(multipart, utility::conversions::to_string_t("body"));
|
||||
}
|
||||
@@ -212,7 +214,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
|
||||
}
|
||||
json = web::json::value::array(jsonArray);
|
||||
}
|
||||
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
}
|
||||
// multipart formdata
|
||||
@@ -229,7 +231,7 @@ pplx::task<void> UserApi::createUsersWithArrayInput(std::vector<std::shared_ptr<
|
||||
}
|
||||
multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json")));
|
||||
}
|
||||
|
||||
|
||||
httpBody = multipart;
|
||||
requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary();
|
||||
}
|
||||
@@ -334,7 +336,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
|
||||
}
|
||||
json = web::json::value::array(jsonArray);
|
||||
}
|
||||
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
}
|
||||
// multipart formdata
|
||||
@@ -351,7 +353,7 @@ pplx::task<void> UserApi::createUsersWithListInput(std::vector<std::shared_ptr<U
|
||||
}
|
||||
multipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json")));
|
||||
}
|
||||
|
||||
|
||||
httpBody = multipart;
|
||||
requestHttpContentType += utility::conversions::to_string_t("; boundary=") + multipart->getBoundary();
|
||||
}
|
||||
@@ -893,6 +895,7 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
|
||||
web::json::value json;
|
||||
|
||||
json = ModelBase::toJson(body);
|
||||
|
||||
|
||||
httpBody = std::shared_ptr<IHttpBody>( new JsonBody( json ) );
|
||||
}
|
||||
@@ -901,7 +904,8 @@ pplx::task<void> UserApi::updateUser(utility::string_t username, std::shared_ptr
|
||||
{
|
||||
requestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
|
||||
std::shared_ptr<MultipartFormData> multipart(new MultipartFormData);
|
||||
if(body.get())
|
||||
|
||||
if(body.get())
|
||||
{
|
||||
body->toMultipart(multipart, utility::conversions::to_string_t("body"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user