diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 4c4addf5a673..296bce15c313 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1693,6 +1693,7 @@ public CodegenProperty fromProperty(String name, Schema p) { } if (p instanceof DateSchema || SchemaTypeUtil.DATE_FORMAT.equals(p.getFormat())) { + property.isString = false; // for backward compatibility with 2.x property.isDate = true; if (p.getEnum() != null) { List _enum = p.getEnum(); @@ -1710,6 +1711,7 @@ public CodegenProperty fromProperty(String name, Schema p) { } if (p instanceof DateTimeSchema || SchemaTypeUtil.DATE_TIME_FORMAT.equals(p.getFormat())) { + property.isString = false; // for backward compatibility with 2.x property.isDateTime = true; if (p.getEnum() != null) { List _enum = p.getEnum(); diff --git a/modules/openapi-generator/src/main/resources/qt5cpp/model-body.mustache b/modules/openapi-generator/src/main/resources/qt5cpp/model-body.mustache index d903823911a6..7634ec32ed7f 100644 --- a/modules/openapi-generator/src/main/resources/qt5cpp/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/qt5cpp/model-body.mustache @@ -220,7 +220,24 @@ bool bool isObjectUpdated = false; do{ {{#vars}} - {{#isPrimitiveType}}if(m_{{name}}_isSet){ isObjectUpdated = true; break;}{{/isPrimitiveType}}{{#isContainer}}if({{name}}->size() > 0){ isObjectUpdated = true; break;}{{/isContainer}}{{^isContainer}}{{#complexType}}{{^isString}}{{^isDateTime}}if({{name}} != nullptr && {{name}}->isSet()){ isObjectUpdated = true; break;}{{/isDateTime}}{{/isString}}{{#isString}}if({{name}} != nullptr && *{{name}} != QString("")){ isObjectUpdated = true; break;}{{/isString}}{{/complexType}}{{/isContainer}} + {{#isPrimitiveType}} + if(m_{{name}}_isSet){ isObjectUpdated = true; break;} + {{/isPrimitiveType}} + {{#isContainer}} + if({{name}}->size() > 0){ isObjectUpdated = true; break;} + {{/isContainer}} + {{^isContainer}} + {{#complexType}} + {{^isString}} + {{^isDateTime}} + if({{name}} != nullptr && {{name}}->isSet()){ isObjectUpdated = true; break;} + {{/isDateTime}} + {{/isString}} + {{#isString}} + if({{name}} != nullptr && *{{name}} != QString("")){ isObjectUpdated = true; break;} + {{/isString}} + {{/complexType}} + {{/isContainer}} {{/vars}} }while(false); return isObjectUpdated; diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp index 184856cdeb69..dd9c9a6b9a87 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp @@ -111,9 +111,6 @@ SWGOrder::asJsonObject() { if(m_quantity_isSet){ obj.insert("quantity", QJsonValue(quantity)); } - if(ship_date != nullptr && *ship_date != QString("")){ - toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); - } if(ship_date != nullptr) { toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); } @@ -195,7 +192,6 @@ SWGOrder::isSet(){ if(m_id_isSet){ isObjectUpdated = true; break;} if(m_pet_id_isSet){ isObjectUpdated = true; break;} if(m_quantity_isSet){ isObjectUpdated = true; break;} - if(ship_date != nullptr && *ship_date != QString("")){ isObjectUpdated = true; break;} if(status != nullptr && *status != QString("")){ isObjectUpdated = true; break;} if(m_complete_isSet){ isObjectUpdated = true; break;} }while(false); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index c4e2b97f3c1f..37122be9f223 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -119,7 +119,7 @@ SWGStoreApi::getInventoryCallback(SWGHttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - QMap* output = NULL; + QMap* output = new QMap(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array);