mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 21:47:13 +00:00
[C++] [cpp-rest-sdk] Check for null values (#990)
* Check whether a value is present but null * Update Petstore sample
This commit is contained in:
committed by
William Cheng
parent
6a1e560540
commit
2d99836e90
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by OpenAPI-Generator 3.3.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
@@ -79,27 +79,51 @@ void Order::fromJson(web::json::value& val)
|
||||
{
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
{
|
||||
setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("id")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setId(ModelBase::int64_tFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("petId")))
|
||||
{
|
||||
setPetId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("petId")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("petId")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setPetId(ModelBase::int64_tFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("quantity")))
|
||||
{
|
||||
setQuantity(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("quantity")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("quantity")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setQuantity(ModelBase::int32_tFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("shipDate")))
|
||||
{
|
||||
setShipDate(ModelBase::dateFromJson(val[utility::conversions::to_string_t("shipDate")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("shipDate")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setShipDate(ModelBase::dateFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("status")))
|
||||
{
|
||||
setStatus(ModelBase::stringFromJson(val[utility::conversions::to_string_t("status")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("status")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setStatus(ModelBase::stringFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("complete")))
|
||||
{
|
||||
setComplete(ModelBase::boolFromJson(val[utility::conversions::to_string_t("complete")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("complete")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setComplete(ModelBase::boolFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user