diff --git a/bin/cpp-qt5-petstore.sh b/bin/cpp-qt5-petstore.sh index 56db53e7fadc..ee4f31119977 100755 --- a/bin/cpp-qt5-petstore.sh +++ b/bin/cpp-qt5-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@" +ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/cpp-qt5/client/OAIInline_object.cpp b/samples/client/petstore/cpp-qt5/client/OAIInline_object.cpp deleted file mode 100644 index 5d5218fb1040..000000000000 --- a/samples/client/petstore/cpp-qt5/client/OAIInline_object.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -#include "OAIInline_object.h" - -#include "OAIHelpers.h" - -#include -#include -#include -#include - -namespace OpenAPI { - -OAIInline_object::OAIInline_object(QString json) { - this->init(); - this->fromJson(json); -} - -OAIInline_object::OAIInline_object() { - this->init(); -} - -OAIInline_object::~OAIInline_object() { - -} - -void -OAIInline_object::init() { - - m_name_isSet = false; - m_name_isValid = false; - - m_status_isSet = false; - m_status_isValid = false; - } - -void -OAIInline_object::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void -OAIInline_object::fromJsonObject(QJsonObject json) { - - m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]); - - - m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); - - -} - -QString -OAIInline_object::asJson () const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject -OAIInline_object::asJsonObject() const { - QJsonObject obj; - if(m_name_isSet){ - obj.insert(QString("name"), ::OpenAPI::toJsonValue(name)); - } - if(m_status_isSet){ - obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); - } - return obj; -} - - -QString -OAIInline_object::getName() const { - return name; -} -void -OAIInline_object::setName(const QString &name) { - this->name = name; - this->m_name_isSet = true; -} - - -QString -OAIInline_object::getStatus() const { - return status; -} -void -OAIInline_object::setStatus(const QString &status) { - this->status = status; - this->m_status_isSet = true; -} - -bool -OAIInline_object::isSet() const { - bool isObjectUpdated = false; - do{ - if(m_name_isSet){ isObjectUpdated = true; break;} - - if(m_status_isSet){ isObjectUpdated = true; break;} - }while(false); - return isObjectUpdated; -} - -bool -OAIInline_object::isValid() const { - // only required properties are required for the object to be considered valid - return true; -} - -} - diff --git a/samples/client/petstore/cpp-qt5/client/OAIInline_object.h b/samples/client/petstore/cpp-qt5/client/OAIInline_object.h deleted file mode 100644 index cde555a97c69..000000000000 --- a/samples/client/petstore/cpp-qt5/client/OAIInline_object.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIInline_object.h - * - * - */ - -#ifndef OAIInline_object_H -#define OAIInline_object_H - -#include - - -#include - -#include "OAIObject.h" -#include "OAIEnum.h" - -namespace OpenAPI { - -class OAIInline_object: public OAIObject { -public: - OAIInline_object(); - OAIInline_object(QString json); - ~OAIInline_object() override; - - QString asJson () const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - - QString getName() const; - void setName(const QString &name); - - - QString getStatus() const; - void setStatus(const QString &status); - - - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void init(); - - QString name; - bool m_name_isSet; - bool m_name_isValid; - - QString status; - bool m_status_isSet; - bool m_status_isValid; - - }; - -} - -Q_DECLARE_METATYPE(OpenAPI::OAIInline_object) - -#endif // OAIInline_object_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.cpp b/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.cpp deleted file mode 100644 index 3624546e32e7..000000000000 --- a/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -#include "OAIInline_object_1.h" - -#include "OAIHelpers.h" - -#include -#include -#include -#include - -namespace OpenAPI { - -OAIInline_object_1::OAIInline_object_1(QString json) { - this->init(); - this->fromJson(json); -} - -OAIInline_object_1::OAIInline_object_1() { - this->init(); -} - -OAIInline_object_1::~OAIInline_object_1() { - -} - -void -OAIInline_object_1::init() { - - m_additional_metadata_isSet = false; - m_additional_metadata_isValid = false; - - m_file_isSet = false; - m_file_isValid = false; - } - -void -OAIInline_object_1::fromJson(QString jsonString) { - QByteArray array (jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void -OAIInline_object_1::fromJsonObject(QJsonObject json) { - - m_additional_metadata_isValid = ::OpenAPI::fromJsonValue(additional_metadata, json[QString("additionalMetadata")]); - - - m_file_isValid = ::OpenAPI::fromJsonValue(file, json[QString("file")]); - - -} - -QString -OAIInline_object_1::asJson () const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject -OAIInline_object_1::asJsonObject() const { - QJsonObject obj; - if(m_additional_metadata_isSet){ - obj.insert(QString("additionalMetadata"), ::OpenAPI::toJsonValue(additional_metadata)); - } - if(file.isSet()){ - obj.insert(QString("file"), ::OpenAPI::toJsonValue(file)); - } - return obj; -} - - -QString -OAIInline_object_1::getAdditionalMetadata() const { - return additional_metadata; -} -void -OAIInline_object_1::setAdditionalMetadata(const QString &additional_metadata) { - this->additional_metadata = additional_metadata; - this->m_additional_metadata_isSet = true; -} - - -OAIHttpRequestInputFileElement* -OAIInline_object_1::getFile() const { - return file; -} -void -OAIInline_object_1::setFile(const OAIHttpRequestInputFileElement* &file) { - this->file = file; - this->m_file_isSet = true; -} - -bool -OAIInline_object_1::isSet() const { - bool isObjectUpdated = false; - do{ - if(m_additional_metadata_isSet){ isObjectUpdated = true; break;} - - if(file.isSet()){ isObjectUpdated = true; break;} - }while(false); - return isObjectUpdated; -} - -bool -OAIInline_object_1::isValid() const { - // only required properties are required for the object to be considered valid - return true; -} - -} - diff --git a/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.h b/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.h deleted file mode 100644 index 3f2ff572eec2..000000000000 --- a/samples/client/petstore/cpp-qt5/client/OAIInline_object_1.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIInline_object_1.h - * - * - */ - -#ifndef OAIInline_object_1_H -#define OAIInline_object_1_H - -#include - - -#include "OAIHttpRequest.h" -#include - -#include "OAIObject.h" -#include "OAIEnum.h" - -namespace OpenAPI { - -class OAIInline_object_1: public OAIObject { -public: - OAIInline_object_1(); - OAIInline_object_1(QString json); - ~OAIInline_object_1() override; - - QString asJson () const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - - QString getAdditionalMetadata() const; - void setAdditionalMetadata(const QString &additional_metadata); - - - OAIHttpRequestInputFileElement* getFile() const; - void setFile(const OAIHttpRequestInputFileElement* &file); - - - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void init(); - - QString additional_metadata; - bool m_additional_metadata_isSet; - bool m_additional_metadata_isValid; - - OAIHttpRequestInputFileElement* file; - bool m_file_isSet; - bool m_file_isValid; - - }; - -} - -Q_DECLARE_METATYPE(OpenAPI::OAIInline_object_1) - -#endif // OAIInline_object_1_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp index 808206ac29f5..1341a73c3b95 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp @@ -52,7 +52,7 @@ void OAIPetApi::addHeaders(const QString& key, const QString& value){ void -OAIPetApi::addPet(const OAIPet& oai_pet) { +OAIPetApi::addPet(const OAIPet& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -61,7 +61,7 @@ OAIPetApi::addPet(const OAIPet& oai_pet) { OAIHttpRequestInput input(fullPath, "POST"); - QString output = oai_pet.asJson(); + QString output = body.asJson(); input.request_body.append(output); @@ -247,7 +247,7 @@ OAIPetApi::findPetsByStatusCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::findPetsByTags(const QList& tags, const qint32& max_count) { +OAIPetApi::findPetsByTags(const QList& tags) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/findByTags"); @@ -291,14 +291,6 @@ OAIPetApi::findPetsByTags(const QList& tags, const qint32& max_count) { } } - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("maxCount")) - .append("=") - .append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(max_count))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -399,7 +391,7 @@ OAIPetApi::getPetByIdCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::updatePet(const OAIPet& oai_pet) { +OAIPetApi::updatePet(const OAIPet& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -408,7 +400,7 @@ OAIPetApi::updatePet(const OAIPet& oai_pet) { OAIHttpRequestInput input(fullPath, "PUT"); - QString output = oai_pet.asJson(); + QString output = body.asJson(); input.request_body.append(output); diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h index 2e89093994e9..449de958530e 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h @@ -37,12 +37,12 @@ class OAIPetApi: public QObject { void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); - void addPet(const OAIPet& oai_pet); + void addPet(const OAIPet& body); void deletePet(const qint64& pet_id, const QString& api_key); void findPetsByStatus(const QList& status); - void findPetsByTags(const QList& tags, const qint32& max_count); + void findPetsByTags(const QList& tags); void getPetById(const qint64& pet_id); - void updatePet(const OAIPet& oai_pet); + void updatePet(const OAIPet& body); void updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status); void uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpRequestInputFileElement*& file); diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp index 681dc87f76a5..7b2e37f635b4 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp @@ -204,7 +204,7 @@ OAIStoreApi::getOrderByIdCallback(OAIHttpRequestWorker * worker) { } void -OAIStoreApi::placeOrder(const OAIOrder& oai_order) { +OAIStoreApi::placeOrder(const OAIOrder& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order"); @@ -213,7 +213,7 @@ OAIStoreApi::placeOrder(const OAIOrder& oai_order) { OAIHttpRequestInput input(fullPath, "POST"); - QString output = oai_order.asJson(); + QString output = body.asJson(); input.request_body.append(output); diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h index ebda579b9ba1..2f9d41b99853 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h @@ -39,7 +39,7 @@ class OAIStoreApi: public QObject { void deleteOrder(const QString& order_id); void getInventory(); void getOrderById(const qint64& order_id); - void placeOrder(const OAIOrder& oai_order); + void placeOrder(const OAIOrder& body); private: QString basePath; diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp index f14ab4d08dd7..57556eab7882 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp @@ -52,7 +52,7 @@ void OAIUserApi::addHeaders(const QString& key, const QString& value){ void -OAIUserApi::createUser(const OAIUser& oai_user) { +OAIUserApi::createUser(const OAIUser& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user"); @@ -61,7 +61,7 @@ OAIUserApi::createUser(const OAIUser& oai_user) { OAIHttpRequestInput input(fullPath, "POST"); - QString output = oai_user.asJson(); + QString output = body.asJson(); input.request_body.append(output); @@ -101,7 +101,7 @@ OAIUserApi::createUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::createUsersWithArrayInput(const QList& oai_user) { +OAIUserApi::createUsersWithArrayInput(const QList& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); @@ -110,7 +110,7 @@ OAIUserApi::createUsersWithArrayInput(const QList& oai_user) { OAIHttpRequestInput input(fullPath, "POST"); - QJsonDocument doc(::OpenAPI::toJsonValue(oai_user).toArray()); + QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -151,7 +151,7 @@ OAIUserApi::createUsersWithArrayInputCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::createUsersWithListInput(const QList& oai_user) { +OAIUserApi::createUsersWithListInput(const QList& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); @@ -160,7 +160,7 @@ OAIUserApi::createUsersWithListInput(const QList& oai_user) { OAIHttpRequestInput input(fullPath, "POST"); - QJsonDocument doc(::OpenAPI::toJsonValue(oai_user).toArray()); + QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -406,7 +406,7 @@ OAIUserApi::logoutUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::updateUser(const QString& username, const OAIUser& oai_user) { +OAIUserApi::updateUser(const QString& username, const OAIUser& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); QString usernamePathParam("{"); @@ -418,7 +418,7 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& oai_user) { OAIHttpRequestInput input(fullPath, "PUT"); - QString output = oai_user.asJson(); + QString output = body.asJson(); input.request_body.append(output); diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h b/samples/client/petstore/cpp-qt5/client/OAIUserApi.h index b72cc28e42b3..454210caa6d2 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIUserApi.h @@ -36,14 +36,14 @@ class OAIUserApi: public QObject { void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); - void createUser(const OAIUser& oai_user); - void createUsersWithArrayInput(const QList& oai_user); - void createUsersWithListInput(const QList& oai_user); + void createUser(const OAIUser& body); + void createUsersWithArrayInput(const QList& body); + void createUsersWithListInput(const QList& body); void deleteUser(const QString& username); void getUserByName(const QString& username); void loginUser(const QString& username, const QString& password); void logoutUser(); - void updateUser(const QString& username, const OAIUser& oai_user); + void updateUser(const QString& username, const OAIUser& body); private: QString basePath; diff --git a/samples/client/petstore/cpp-qt5/client/client.pri b/samples/client/petstore/cpp-qt5/client/client.pri index e51b4c310803..ca6c9b552457 100644 --- a/samples/client/petstore/cpp-qt5/client/client.pri +++ b/samples/client/petstore/cpp-qt5/client/client.pri @@ -4,8 +4,6 @@ HEADERS += \ # Models $${PWD}/OAIApiResponse.h \ $${PWD}/OAICategory.h \ - $${PWD}/OAIInline_object.h \ - $${PWD}/OAIInline_object_1.h \ $${PWD}/OAIOrder.h \ $${PWD}/OAIPet.h \ $${PWD}/OAITag.h \ @@ -24,8 +22,6 @@ SOURCES += \ # Models $${PWD}/OAIApiResponse.cpp \ $${PWD}/OAICategory.cpp \ - $${PWD}/OAIInline_object.cpp \ - $${PWD}/OAIInline_object_1.cpp \ $${PWD}/OAIOrder.cpp \ $${PWD}/OAIPet.cpp \ $${PWD}/OAITag.cpp \