forked from loafle/openapi-generator-original
Check cJSON_IsNull when the data type is datetime (#13884)
This commit is contained in:
parent
c71ec554dc
commit
c3abdb6c57
@ -669,7 +669,7 @@ fail:
|
|||||||
{{/isDate}}
|
{{/isDate}}
|
||||||
{{#isDateTime}}
|
{{#isDateTime}}
|
||||||
{{^required}}if ({{{name}}}) { {{/required}}
|
{{^required}}if ({{{name}}}) { {{/required}}
|
||||||
if(!cJSON_IsString({{{name}}}))
|
if(!cJSON_IsString({{{name}}}) && !cJSON_IsNull({{{name}}}))
|
||||||
{
|
{
|
||||||
goto end; //DateTime
|
goto end; //DateTime
|
||||||
}
|
}
|
||||||
@ -893,7 +893,7 @@ fail:
|
|||||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||||
{{/isDate}}
|
{{/isDate}}
|
||||||
{{#isDateTime}}
|
{{#isDateTime}}
|
||||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
{{^required}}{{{name}}} && !cJSON_IsNull({{{name}}}) ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||||
{{/isDateTime}}
|
{{/isDateTime}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
|
@ -150,7 +150,7 @@ order_t *order_parseFromJSON(cJSON *orderJSON){
|
|||||||
// order->ship_date
|
// order->ship_date
|
||||||
cJSON *ship_date = cJSON_GetObjectItemCaseSensitive(orderJSON, "shipDate");
|
cJSON *ship_date = cJSON_GetObjectItemCaseSensitive(orderJSON, "shipDate");
|
||||||
if (ship_date) {
|
if (ship_date) {
|
||||||
if(!cJSON_IsString(ship_date))
|
if(!cJSON_IsString(ship_date) && !cJSON_IsNull(ship_date))
|
||||||
{
|
{
|
||||||
goto end; //DateTime
|
goto end; //DateTime
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ order_t *order_parseFromJSON(cJSON *orderJSON){
|
|||||||
id ? id->valuedouble : 0,
|
id ? id->valuedouble : 0,
|
||||||
pet_id ? pet_id->valuedouble : 0,
|
pet_id ? pet_id->valuedouble : 0,
|
||||||
quantity ? quantity->valuedouble : 0,
|
quantity ? quantity->valuedouble : 0,
|
||||||
ship_date ? strdup(ship_date->valuestring) : NULL,
|
ship_date && !cJSON_IsNull(ship_date) ? strdup(ship_date->valuestring) : NULL,
|
||||||
status ? statusVariable : -1,
|
status ? statusVariable : -1,
|
||||||
complete ? complete->valueint : 0
|
complete ? complete->valueint : 0
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user