forked from loafle/openapi-generator-original
[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.
|
||||
*/
|
||||
@@ -61,15 +61,27 @@ void ApiResponse::fromJson(web::json::value& val)
|
||||
{
|
||||
if(val.has_field(utility::conversions::to_string_t("code")))
|
||||
{
|
||||
setCode(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("code")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("code")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setCode(ModelBase::int32_tFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("type")))
|
||||
{
|
||||
setType(ModelBase::stringFromJson(val[utility::conversions::to_string_t("type")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("type")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setType(ModelBase::stringFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("message")))
|
||||
{
|
||||
setMessage(ModelBase::stringFromJson(val[utility::conversions::to_string_t("message")]));
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("message")];
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setMessage(ModelBase::stringFromJson(fieldValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user