diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index e50d69dabf..ff75ae6255 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -3171,7 +3171,12 @@ public class DefaultCodegen { buf.append(StringUtils.capitalize(part)); } } - return buf.toString().replaceAll("[^a-zA-Z ]", ""); + String returnTag = buf.toString().replaceAll("[^a-zA-Z0-9_]", ""); + if (returnTag.matches("\\d.*")) { + return "_" + returnTag; + } else { + return returnTag; + } } /** diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache index f9a55ba2b7..e55a82416e 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache @@ -134,7 +134,7 @@ namespace {{packageName}}.{{packageContext}}.Utils private static IDictionary> CreateParsers() { var parsers = ImmutableDictionary.CreateBuilder>(); - parsers.Put(typeof(string), value => value); + parsers.Put(typeof(string), value => value.Value); parsers.Put(typeof(bool), SafeParse(bool.Parse)); parsers.Put(typeof(bool?), SafeParse(bool.Parse)); parsers.Put(typeof(byte), SafeParse(byte.Parse)); @@ -411,4 +411,4 @@ namespace {{packageName}}.{{packageContext}}.Utils Path, Header } -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache index f4701f860d..33d7d49099 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache @@ -37,7 +37,7 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q HttpRequestWorker::HttpRequestWorker(QObject *parent) - : QObject(parent), manager(NULL) + : QObject(parent), manager(nullptr) { qsrand(QDateTime::currentDateTime().toTime_t()); @@ -181,8 +181,8 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { // ensure necessary variables are available if ( - file_info->local_filename == NULL || file_info->local_filename.isEmpty() - || file_info->variable_name == NULL || file_info->variable_name.isEmpty() + file_info->local_filename == nullptr || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr || file_info->variable_name.isEmpty() || !fi.exists() || !fi.isFile() || !fi.isReadable() ) { // silent abort for the current file @@ -196,7 +196,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { } // ensure filename for the request - if (file_info->request_filename == NULL || file_info->request_filename.isEmpty()) { + if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { file_info->request_filename = fi.fileName(); if (file_info->request_filename.isEmpty()) { file_info->request_filename = "file"; @@ -215,7 +215,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { )); request_content.append(new_line); - if (file_info->mime_type != NULL && !file_info->mime_type.isEmpty()) { + if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { request_content.append("Content-Type: "); request_content.append(file_info->mime_type); request_content.append(new_line); diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index a5fee37258..5392248285 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -87,7 +87,7 @@ void HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "{{httpMethod}}"); - {{#formParams}}if ({{paramName}} != NULL) { + {{#formParams}}if ({{paramName}} != nullptr) { {{^isFile}}input.add_var("{{baseName}}", *{{paramName}});{{/isFile}}{{#isFile}}input.add_file("{{baseName}}", (*{{paramName}}).local_filename, (*{{paramName}}).request_filename, (*{{paramName}}).mime_type);{{/isFile}} } {{/formParams}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache index fb7b29b010..9bbf6ab0e0 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/helpers-body.mustache @@ -10,7 +10,7 @@ namespace Swagger { void setValue(void* value, QJsonValue obj, QString type, QString complexType) { - if(value == NULL) { + if(value == nullptr) { // can't set value with a null pointer return; } @@ -37,7 +37,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { else if (QStringLiteral("QString").compare(type) == 0) { QString **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -45,19 +45,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QDateTime").compare(type) == 0) { QDateTime **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -65,19 +65,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QDate").compare(type) == 0) { QDate **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -85,19 +85,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QByteArray").compare(type) == 0) { QByteArray **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -106,20 +106,20 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); SWGObject * so = (SWGObject*)Swagger::create(type); - if(so != NULL) { + if(so != nullptr) { so->fromJsonObject(jsonObj); SWGObject **val = static_cast(value); delete *val; @@ -167,19 +167,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { output->append((void*)&val); } else if(QStringLiteral("QString").compare(complexType) == 0) { - QString val; + QString * val = new QString(); setValue(&val, jval, QStringLiteral("QString"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } else if(QStringLiteral("QDate").compare(complexType) == 0) { - QDate val; + QDate * val = new QDate(); setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } else if(QStringLiteral("QDateTime").compare(complexType) == 0) { - QDateTime val; + QDateTime * val = new QDateTime(); setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } } } @@ -191,14 +191,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { void toJsonValue(QString name, void* value, QJsonObject* output, QString type) { - if(value == NULL) { + if(value == nullptr) { return; } if(type.startsWith("SWG")) { SWGObject *swgObject = reinterpret_cast(value); - if(swgObject != NULL) { + if(swgObject != nullptr) { QJsonObject* o = (*swgObject).asJsonObject(); - if(name != NULL) { + if(name != nullptr) { output->insert(name, *o); delete o; } @@ -253,7 +253,7 @@ toJsonArray(QList* value, QJsonArray* output, QString innerName, QString foreach(void* obj, *value) { QJsonObject element; - toJsonValue(NULL, obj, &element, innerType); + toJsonValue(nullptr, obj, &element, innerType); output->append(element); } } diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache index a7a8bf0afb..bde2a260c6 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache @@ -27,13 +27,15 @@ namespace Swagger { void {{classname}}::init() { - {{#vars}}{{name}} = {{{defaultValue}}}; + {{#vars}} + {{name}} = {{{defaultValue}}}; {{/vars}} } void {{classname}}::cleanup() { - {{#vars}}{{#complexType}}if({{name}} != NULL) { + {{#vars}}{{#complexType}} + if({{name}} != nullptr) { {{#isContainer}}QList<{{complexType}}*>* arr = {{name}}; foreach({{complexType}}* o, *arr) { delete o; @@ -54,7 +56,12 @@ void void {{classname}}::fromJsonObject(QJsonObject &pJson) { - {{#vars}}setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}"); + {{#vars}} + {{^isContainer}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}} + {{#isContainer}} + {{#complexType}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}");{{/complexType}} + {{^complexType}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}} + {{/isContainer}} {{/vars}} } @@ -71,21 +78,18 @@ QString QJsonObject* {{classname}}::asJsonObject() { QJsonObject* obj = new QJsonObject(); - {{#vars}}{{#complexType}} - {{^isContainer}}{{#complexType}} - toJsonValue(QString("{{name}}"), {{name}}, obj, QString("{{complexType}}")); - {{/complexType}}{{^complexType}} - else if({{name}} != NULL && *{{name}} != NULL) { - obj->insert("{{name}}", QJsonValue(*{{name}})); - }{{/complexType}} - {{/isContainer}}{{#isContainer}} - QList<{{complexType}}*>* {{name}}List = {{name}}; + {{#vars}}{{#complexType}}{{^isContainer}}{{#complexType}} + toJsonValue(QString("{{name}}"), {{name}}, obj, QString("{{complexType}}"));{{/complexType}}{{^complexType}} + if({{name}} != nullptr && *{{name}} != nullptr) { + obj->insert("{{name}}", QJsonValue(*{{name}})); + }{{/complexType}}{{/isContainer}}{{#isContainer}} QJsonArray {{name}}JsonArray; toJsonArray((QList*){{name}}, &{{name}}JsonArray, "{{name}}", "{{complexType}}"); - - obj->insert("{{name}}", {{name}}JsonArray); - {{/isContainer}} - {{/complexType}}{{^complexType}}obj->insert("{{name}}", QJsonValue({{name}}));{{/complexType}} + obj->insert("{{name}}", {{name}}JsonArray);{{/isContainer}}{{/complexType}}{{^complexType}}{{^isContainer}} + obj->insert("{{name}}", QJsonValue({{name}}));{{/isContainer}}{{#isContainer}} + QJsonArray {{name}}JsonArray; + toJsonArray((QList*){{name}}, &{{name}}JsonArray, "{{name}}", "{{items.baseType}}"); + obj->insert("{{name}}", {{name}}JsonArray);{{/isContainer}}{{/complexType}} {{/vars}} return obj; diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache index 48e07bcbda..49d50d0dae 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache @@ -32,12 +32,15 @@ public: void fromJsonObject(QJsonObject &json); {{classname}}* fromJson(QString &jsonString); - {{#vars}}{{{datatype}}} {{getter}}(); + {{#vars}} + {{{datatype}}} {{getter}}(); void {{setter}}({{{datatype}}} {{name}}); + {{/vars}} private: - {{#vars}}{{{datatype}}} {{name}}; + {{#vars}} + {{{datatype}}} {{name}}; {{/vars}} }; diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache index 349ccaf3b9..8859fe7db3 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/modelFactory.mustache @@ -11,19 +11,19 @@ namespace Swagger { return new {{classname}}(); } {{/model}}{{/models}} - return NULL; + return nullptr; } inline void* create(QString json, QString type) { void* val = create(type); - if(val != NULL) { + if(val != nullptr) { SWGObject* obj = static_cast(val); return obj->fromJson(json); } if(type.startsWith("QString")) { return new QString(); } - return NULL; + return nullptr; } } /* namespace Swagger */ diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache index 14a2371635..62b9975d84 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/object.mustache @@ -7,12 +7,12 @@ class {{prefix}}Object { public: virtual QJsonObject* asJsonObject() { - return NULL; + return nullptr; } virtual ~SWGObject() {} virtual SWGObject* fromJson(QString &jsonString) { Q_UNUSED(jsonString); - return NULL; + return nullptr; } virtual void fromJsonObject(QJsonObject &json) { Q_UNUSED(json); diff --git a/modules/swagger-codegen/src/main/resources/undertow/README.mustache b/modules/swagger-codegen/src/main/resources/undertow/README.mustache index 9f1e36dd16..a983dba343 100644 --- a/modules/swagger-codegen/src/main/resources/undertow/README.mustache +++ b/modules/swagger-codegen/src/main/resources/undertow/README.mustache @@ -20,9 +20,5 @@ oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-ser Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w ``` -Postman is the best tool to test REST APIs - Add "Authorization" header with value as above token and a dummy message will return from the generated stub. - - diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java index e96ad45280..37050a1be4 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java @@ -13,6 +13,17 @@ import java.util.List; public class CodegenTest { + @Test(description = "test sanitizeTag") + public void sanitizeTagTest() { + final DefaultCodegen codegen = new DefaultCodegen(); + Assert.assertEquals(codegen.sanitizeTag("foo"), "Foo"); + Assert.assertEquals(codegen.sanitizeTag("foo bar"), "FooBar"); + Assert.assertEquals(codegen.sanitizeTag("foo_bar"), "Foo_bar"); + Assert.assertEquals(codegen.sanitizeTag("foo1 bar2"), "Foo1Bar2"); + Assert.assertEquals(codegen.sanitizeTag("foo bar 1"), "FooBar1"); + Assert.assertEquals(codegen.sanitizeTag("1foo"), "_1foo"); + } + @Test(description = "read a file upload param from a 2.0 spec") public void fileUploadParamTest() { final Swagger model = parseAndPrepareSwagger("src/test/resources/2_0/petstore.json"); diff --git a/samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user b/samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user index 0b360e583f..8a5eae5cde 100644 --- a/samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user +++ b/samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp index 7a06f16a59..41a6256213 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp +++ b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp @@ -23,7 +23,7 @@ */ -#include "ApiResponse.h" +#include "SWGApiResponse.h" #include "SWGHelpers.h" @@ -35,39 +35,41 @@ namespace Swagger { -ApiResponse::ApiResponse(QString* json) { +SWGApiResponse::SWGApiResponse(QString* json) { init(); this->fromJson(*json); } -ApiResponse::ApiResponse() { +SWGApiResponse::SWGApiResponse() { init(); } -ApiResponse::~ApiResponse() { +SWGApiResponse::~SWGApiResponse() { this->cleanup(); } void -ApiResponse::init() { +SWGApiResponse::init() { code = 0; -type = new QString(""); -message = new QString(""); + type = new QString(""); + message = new QString(""); } void -ApiResponse::cleanup() { +SWGApiResponse::cleanup() { -if(type != NULL) { + + if(type != nullptr) { delete type; } -if(message != NULL) { + + if(message != nullptr) { delete message; } } -ApiResponse* -ApiResponse::fromJson(QString &json) { +SWGApiResponse* +SWGApiResponse::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -76,14 +78,14 @@ ApiResponse::fromJson(QString &json) { } void -ApiResponse::fromJsonObject(QJsonObject &pJson) { - setValue(&code, pJson["code"], "qint32", ""); -setValue(&type, pJson["type"], "QString", "QString"); -setValue(&message, pJson["message"], "QString", "QString"); +SWGApiResponse::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&code, pJson["code"], "qint32", ""); + ::Swagger::setValue(&type, pJson["type"], "QString", "QString"); + ::Swagger::setValue(&message, pJson["message"], "QString", "QString"); } QString -ApiResponse::asJson () +SWGApiResponse::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -93,47 +95,42 @@ ApiResponse::asJson () } QJsonObject* -ApiResponse::asJsonObject() { +SWGApiResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("code", QJsonValue(code)); - toJsonValue(QString("type"), type, obj, QString("QString")); - - - toJsonValue(QString("message"), message, obj, QString("QString")); - - return obj; } qint32 -ApiResponse::getCode() { +SWGApiResponse::getCode() { return code; } void -ApiResponse::setCode(qint32 code) { +SWGApiResponse::setCode(qint32 code) { this->code = code; } QString* -ApiResponse::getType() { +SWGApiResponse::getType() { return type; } void -ApiResponse::setType(QString* type) { +SWGApiResponse::setType(QString* type) { this->type = type; } QString* -ApiResponse::getMessage() { +SWGApiResponse::getMessage() { return message; } void -ApiResponse::setMessage(QString* message) { +SWGApiResponse::setMessage(QString* message) { this->message = message; } diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.h b/samples/client/petstore/qt5cpp/client/ApiResponse.h index 831afa27a8..0be46acc54 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.h +++ b/samples/client/petstore/qt5cpp/client/ApiResponse.h @@ -56,15 +56,18 @@ public: qint32 getCode(); void setCode(qint32 code); -QString* getType(); + + QString* getType(); void setType(QString* type); -QString* getMessage(); + + QString* getMessage(); void setMessage(QString* message); + private: qint32 code; -QString* type; -QString* message; + QString* type; + QString* message; }; } /* namespace Swagger */ diff --git a/samples/client/petstore/qt5cpp/client/Category.cpp b/samples/client/petstore/qt5cpp/client/Category.cpp index e70d1992b7..631c22a328 100644 --- a/samples/client/petstore/qt5cpp/client/Category.cpp +++ b/samples/client/petstore/qt5cpp/client/Category.cpp @@ -23,7 +23,7 @@ */ -#include "Category.h" +#include "SWGCategory.h" #include "SWGHelpers.h" @@ -35,35 +35,36 @@ namespace Swagger { -Category::Category(QString* json) { +SWGCategory::SWGCategory(QString* json) { init(); this->fromJson(*json); } -Category::Category() { +SWGCategory::SWGCategory() { init(); } -Category::~Category() { +SWGCategory::~SWGCategory() { this->cleanup(); } void -Category::init() { +SWGCategory::init() { id = 0L; -name = new QString(""); + name = new QString(""); } void -Category::cleanup() { +SWGCategory::cleanup() { -if(name != NULL) { + + if(name != nullptr) { delete name; } } -Category* -Category::fromJson(QString &json) { +SWGCategory* +SWGCategory::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -72,13 +73,13 @@ Category::fromJson(QString &json) { } void -Category::fromJsonObject(QJsonObject &pJson) { - setValue(&id, pJson["id"], "qint64", ""); -setValue(&name, pJson["name"], "QString", "QString"); +SWGCategory::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&id, pJson["id"], "qint64", ""); + ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); } QString -Category::asJson () +SWGCategory::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -88,33 +89,31 @@ Category::asJson () } QJsonObject* -Category::asJsonObject() { +SWGCategory::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("id", QJsonValue(id)); - toJsonValue(QString("name"), name, obj, QString("QString")); - - return obj; } qint64 -Category::getId() { +SWGCategory::getId() { return id; } void -Category::setId(qint64 id) { +SWGCategory::setId(qint64 id) { this->id = id; } QString* -Category::getName() { +SWGCategory::getName() { return name; } void -Category::setName(QString* name) { +SWGCategory::setName(QString* name) { this->name = name; } diff --git a/samples/client/petstore/qt5cpp/client/Category.h b/samples/client/petstore/qt5cpp/client/Category.h index d1e9ec0dbf..32f8f734cc 100644 --- a/samples/client/petstore/qt5cpp/client/Category.h +++ b/samples/client/petstore/qt5cpp/client/Category.h @@ -56,12 +56,14 @@ public: qint64 getId(); void setId(qint64 id); -QString* getName(); + + QString* getName(); void setName(QString* name); + private: qint64 id; -QString* name; + QString* name; }; } /* namespace Swagger */ diff --git a/samples/client/petstore/qt5cpp/client/Order.cpp b/samples/client/petstore/qt5cpp/client/Order.cpp index 4b978b44a0..0a7ce0a3f5 100644 --- a/samples/client/petstore/qt5cpp/client/Order.cpp +++ b/samples/client/petstore/qt5cpp/client/Order.cpp @@ -23,7 +23,7 @@ */ -#include "Order.h" +#include "SWGOrder.h" #include "SWGHelpers.h" @@ -35,45 +35,47 @@ namespace Swagger { -Order::Order(QString* json) { +SWGOrder::SWGOrder(QString* json) { init(); this->fromJson(*json); } -Order::Order() { +SWGOrder::SWGOrder() { init(); } -Order::~Order() { +SWGOrder::~SWGOrder() { this->cleanup(); } void -Order::init() { +SWGOrder::init() { id = 0L; -petId = 0L; -quantity = 0; -shipDate = NULL; -status = new QString(""); -complete = false; + pet_id = 0L; + quantity = 0; + ship_date = NULL; + status = new QString(""); + complete = false; } void -Order::cleanup() { +SWGOrder::cleanup() { -if(shipDate != NULL) { - delete shipDate; + + if(ship_date != nullptr) { + delete ship_date; } -if(status != NULL) { + + if(status != nullptr) { delete status; } } -Order* -Order::fromJson(QString &json) { +SWGOrder* +SWGOrder::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -82,17 +84,17 @@ Order::fromJson(QString &json) { } void -Order::fromJsonObject(QJsonObject &pJson) { - setValue(&id, pJson["id"], "qint64", ""); -setValue(&petId, pJson["petId"], "qint64", ""); -setValue(&quantity, pJson["quantity"], "qint32", ""); -setValue(&shipDate, pJson["shipDate"], "QDateTime", "QDateTime"); -setValue(&status, pJson["status"], "QString", "QString"); -setValue(&complete, pJson["complete"], "bool", ""); +SWGOrder::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&id, pJson["id"], "qint64", ""); + ::Swagger::setValue(&pet_id, pJson["pet_id"], "qint64", ""); + ::Swagger::setValue(&quantity, pJson["quantity"], "qint32", ""); + ::Swagger::setValue(&ship_date, pJson["ship_date"], "QDateTime", "QDateTime"); + ::Swagger::setValue(&status, pJson["status"], "QString", "QString"); + ::Swagger::setValue(&complete, pJson["complete"], "bool", ""); } QString -Order::asJson () +SWGOrder::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -102,77 +104,75 @@ Order::asJson () } QJsonObject* -Order::asJsonObject() { +SWGOrder::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("id", QJsonValue(id)); -obj->insert("petId", QJsonValue(petId)); -obj->insert("quantity", QJsonValue(quantity)); - - toJsonValue(QString("shipDate"), shipDate, obj, QString("QDateTime")); - - + obj->insert("pet_id", QJsonValue(pet_id)); + + obj->insert("quantity", QJsonValue(quantity)); + + toJsonValue(QString("ship_date"), ship_date, obj, QString("QDateTime")); - toJsonValue(QString("status"), status, obj, QString("QString")); - - -obj->insert("complete", QJsonValue(complete)); + + obj->insert("complete", QJsonValue(complete)); return obj; } qint64 -Order::getId() { +SWGOrder::getId() { return id; } void -Order::setId(qint64 id) { +SWGOrder::setId(qint64 id) { this->id = id; } qint64 -Order::getPetId() { - return petId; +SWGOrder::getPetId() { + return pet_id; } void -Order::setPetId(qint64 petId) { - this->petId = petId; +SWGOrder::setPetId(qint64 pet_id) { + this->pet_id = pet_id; } qint32 -Order::getQuantity() { +SWGOrder::getQuantity() { return quantity; } void -Order::setQuantity(qint32 quantity) { +SWGOrder::setQuantity(qint32 quantity) { this->quantity = quantity; } QDateTime* -Order::getShipDate() { - return shipDate; +SWGOrder::getShipDate() { + return ship_date; } void -Order::setShipDate(QDateTime* shipDate) { - this->shipDate = shipDate; +SWGOrder::setShipDate(QDateTime* ship_date) { + this->ship_date = ship_date; } QString* -Order::getStatus() { +SWGOrder::getStatus() { return status; } void -Order::setStatus(QString* status) { +SWGOrder::setStatus(QString* status) { this->status = status; } bool -Order::getComplete() { +SWGOrder::getComplete() { return complete; } void -Order::setComplete(bool complete) { +SWGOrder::setComplete(bool complete) { this->complete = complete; } diff --git a/samples/client/petstore/qt5cpp/client/Order.h b/samples/client/petstore/qt5cpp/client/Order.h index 936df4d610..ebdf3b3d81 100644 --- a/samples/client/petstore/qt5cpp/client/Order.h +++ b/samples/client/petstore/qt5cpp/client/Order.h @@ -23,13 +23,13 @@ */ /* - * Order.h + * SWGOrder.h * * An order for a pets from the pet store */ -#ifndef Order_H_ -#define Order_H_ +#ifndef SWGOrder_H_ +#define SWGOrder_H_ #include @@ -42,41 +42,47 @@ namespace Swagger { -class Order: public SWGObject { +class SWGOrder: public SWGObject { public: - Order(); - Order(QString* json); - virtual ~Order(); + SWGOrder(); + SWGOrder(QString* json); + virtual ~SWGOrder(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Order* fromJson(QString &jsonString); + SWGOrder* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); -qint64 getPetId(); - void setPetId(qint64 petId); -qint32 getQuantity(); + + qint64 getPetId(); + void setPetId(qint64 pet_id); + + qint32 getQuantity(); void setQuantity(qint32 quantity); -QDateTime* getShipDate(); - void setShipDate(QDateTime* shipDate); -QString* getStatus(); + + QDateTime* getShipDate(); + void setShipDate(QDateTime* ship_date); + + QString* getStatus(); void setStatus(QString* status); -bool getComplete(); + + bool getComplete(); void setComplete(bool complete); + private: qint64 id; -qint64 petId; -qint32 quantity; -QDateTime* shipDate; -QString* status; -bool complete; + qint64 pet_id; + qint32 quantity; + QDateTime* ship_date; + QString* status; + bool complete; }; } /* namespace Swagger */ -#endif /* Order_H_ */ +#endif /* SWGOrder_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/Pet.cpp b/samples/client/petstore/qt5cpp/client/Pet.cpp index 1b8f4dc714..9480563514 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.cpp +++ b/samples/client/petstore/qt5cpp/client/Pet.cpp @@ -23,7 +23,7 @@ */ -#include "Pet.h" +#include "SWGPet.h" #include "SWGHelpers.h" @@ -35,59 +35,64 @@ namespace Swagger { -Pet::Pet(QString* json) { +SWGPet::SWGPet(QString* json) { init(); this->fromJson(*json); } -Pet::Pet() { +SWGPet::SWGPet() { init(); } -Pet::~Pet() { +SWGPet::~SWGPet() { this->cleanup(); } void -Pet::init() { +SWGPet::init() { id = 0L; -category = new Category(); -name = new QString(""); -photoUrls = new QList(); -tags = new QList(); -status = new QString(""); + category = new SWGCategory(); + name = new QString(""); + photo_urls = new QList(); + tags = new QList(); + status = new QString(""); } void -Pet::cleanup() { +SWGPet::cleanup() { -if(category != NULL) { + + if(category != nullptr) { delete category; } -if(name != NULL) { + + if(name != nullptr) { delete name; } -if(photoUrls != NULL) { - QList* arr = photoUrls; + + if(photo_urls != nullptr) { + QList* arr = photo_urls; foreach(QString* o, *arr) { delete o; } - delete photoUrls; + delete photo_urls; } -if(tags != NULL) { - QList* arr = tags; - foreach(Tag* o, *arr) { + + if(tags != nullptr) { + QList* arr = tags; + foreach(SWGTag* o, *arr) { delete o; } delete tags; } -if(status != NULL) { + + if(status != nullptr) { delete status; } } -Pet* -Pet::fromJson(QString &json) { +SWGPet* +SWGPet::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -96,17 +101,21 @@ Pet::fromJson(QString &json) { } void -Pet::fromJsonObject(QJsonObject &pJson) { - setValue(&id, pJson["id"], "qint64", ""); -setValue(&category, pJson["category"], "Category", "Category"); -setValue(&name, pJson["name"], "QString", "QString"); -setValue(&photoUrls, pJson["photoUrls"], "QList", "QString"); -setValue(&tags, pJson["tags"], "QList", "Tag"); -setValue(&status, pJson["status"], "QString", "QString"); +SWGPet::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&id, pJson["id"], "qint64", ""); + ::Swagger::setValue(&category, pJson["category"], "SWGCategory", "SWGCategory"); + ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); + + ::Swagger::setValue(&photo_urls, pJson["photo_urls"], "QList", "QString"); + + + ::Swagger::setValue(&tags, pJson["tags"], "QList", "SWGTag"); + + ::Swagger::setValue(&status, pJson["status"], "QString", "QString"); } QString -Pet::asJson () +SWGPet::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -116,95 +125,79 @@ Pet::asJson () } QJsonObject* -Pet::asJsonObject() { +SWGPet::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("id", QJsonValue(id)); - - toJsonValue(QString("category"), category, obj, QString("Category")); - - + toJsonValue(QString("category"), category, obj, QString("SWGCategory")); - toJsonValue(QString("name"), name, obj, QString("QString")); - - - - QList* photoUrlsList = photoUrls; - QJsonArray photoUrlsJsonArray; - toJsonArray((QList*)photoUrls, &photoUrlsJsonArray, "photoUrls", "QString"); + QJsonArray photo_urlsJsonArray; + toJsonArray((QList*)photo_urls, &photo_urlsJsonArray, "photo_urls", "QString"); + obj->insert("photo_urls", photo_urlsJsonArray); - obj->insert("photoUrls", photoUrlsJsonArray); - - - - QList* tagsList = tags; QJsonArray tagsJsonArray; - toJsonArray((QList*)tags, &tagsJsonArray, "tags", "Tag"); - + toJsonArray((QList*)tags, &tagsJsonArray, "tags", "SWGTag"); obj->insert("tags", tagsJsonArray); - - toJsonValue(QString("status"), status, obj, QString("QString")); - - return obj; } qint64 -Pet::getId() { +SWGPet::getId() { return id; } void -Pet::setId(qint64 id) { +SWGPet::setId(qint64 id) { this->id = id; } -Category* -Pet::getCategory() { +SWGCategory* +SWGPet::getCategory() { return category; } void -Pet::setCategory(Category* category) { +SWGPet::setCategory(SWGCategory* category) { this->category = category; } QString* -Pet::getName() { +SWGPet::getName() { return name; } void -Pet::setName(QString* name) { +SWGPet::setName(QString* name) { this->name = name; } QList* -Pet::getPhotoUrls() { - return photoUrls; +SWGPet::getPhotoUrls() { + return photo_urls; } void -Pet::setPhotoUrls(QList* photoUrls) { - this->photoUrls = photoUrls; +SWGPet::setPhotoUrls(QList* photo_urls) { + this->photo_urls = photo_urls; } -QList* -Pet::getTags() { +QList* +SWGPet::getTags() { return tags; } void -Pet::setTags(QList* tags) { +SWGPet::setTags(QList* tags) { this->tags = tags; } QString* -Pet::getStatus() { +SWGPet::getStatus() { return status; } void -Pet::setStatus(QString* status) { +SWGPet::setStatus(QString* status) { this->status = status; } diff --git a/samples/client/petstore/qt5cpp/client/Pet.h b/samples/client/petstore/qt5cpp/client/Pet.h index 03070f4150..da2acb64e2 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.h +++ b/samples/client/petstore/qt5cpp/client/Pet.h @@ -23,19 +23,19 @@ */ /* - * Pet.h + * SWGPet.h * * A pet for sale in the pet store */ -#ifndef Pet_H_ -#define Pet_H_ +#ifndef SWGPet_H_ +#define SWGPet_H_ #include -#include "Category.h" -#include "Tag.h" +#include "SWGCategory.h" +#include "SWGTag.h" #include #include @@ -44,41 +44,47 @@ namespace Swagger { -class Pet: public SWGObject { +class SWGPet: public SWGObject { public: - Pet(); - Pet(QString* json); - virtual ~Pet(); + SWGPet(); + SWGPet(QString* json); + virtual ~SWGPet(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - Pet* fromJson(QString &jsonString); + SWGPet* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); -Category* getCategory(); - void setCategory(Category* category); -QString* getName(); + + SWGCategory* getCategory(); + void setCategory(SWGCategory* category); + + QString* getName(); void setName(QString* name); -QList* getPhotoUrls(); - void setPhotoUrls(QList* photoUrls); -QList* getTags(); - void setTags(QList* tags); -QString* getStatus(); + + QList* getPhotoUrls(); + void setPhotoUrls(QList* photo_urls); + + QList* getTags(); + void setTags(QList* tags); + + QString* getStatus(); void setStatus(QString* status); + private: qint64 id; -Category* category; -QString* name; -QList* photoUrls; -QList* tags; -QString* status; + SWGCategory* category; + QString* name; + QList* photo_urls; + QList* tags; + QString* status; }; } /* namespace Swagger */ -#endif /* Pet_H_ */ +#endif /* SWGPet_H_ */ diff --git a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp index cfc295e7e1..db5cb4ff84 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp @@ -33,7 +33,7 @@ namespace Swagger { void setValue(void* value, QJsonValue obj, QString type, QString complexType) { - if(value == NULL) { + if(value == nullptr) { // can't set value with a null pointer return; } @@ -60,7 +60,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { else if (QStringLiteral("QString").compare(type) == 0) { QString **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -68,19 +68,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QDateTime").compare(type) == 0) { QDateTime **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -88,19 +88,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QDate").compare(type) == 0) { QDate **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -108,19 +108,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if (QStringLiteral("QByteArray").compare(type) == 0) { QByteArray **val = static_cast(value); - if(val != NULL) { + if(val != nullptr) { if(!obj.isNull()) { // create a new value and return delete *val; @@ -129,20 +129,20 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { return; } else { - // set target to NULL + // set target to nullptr delete *val; - *val = NULL; + *val = nullptr; } } else { - qDebug() << "Can't set value because the target pointer is NULL"; + qDebug() << "Can't set value because the target pointer is nullptr"; } } else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); SWGObject * so = (SWGObject*)Swagger::create(type); - if(so != NULL) { + if(so != nullptr) { so->fromJsonObject(jsonObj); SWGObject **val = static_cast(value); delete *val; @@ -190,19 +190,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { output->append((void*)&val); } else if(QStringLiteral("QString").compare(complexType) == 0) { - QString val; + QString * val = new QString(); setValue(&val, jval, QStringLiteral("QString"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } else if(QStringLiteral("QDate").compare(complexType) == 0) { - QDate val; + QDate * val = new QDate(); setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } else if(QStringLiteral("QDateTime").compare(complexType) == 0) { - QDateTime val; + QDateTime * val = new QDateTime(); setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral("")); - output->append((void*)&val); + output->append((void*)val); } } } @@ -214,14 +214,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { void toJsonValue(QString name, void* value, QJsonObject* output, QString type) { - if(value == NULL) { + if(value == nullptr) { return; } if(type.startsWith("SWG")) { SWGObject *swgObject = reinterpret_cast(value); - if(swgObject != NULL) { + if(swgObject != nullptr) { QJsonObject* o = (*swgObject).asJsonObject(); - if(name != NULL) { + if(name != nullptr) { output->insert(name, *o); delete o; } @@ -276,7 +276,7 @@ toJsonArray(QList* value, QJsonArray* output, QString innerName, QString foreach(void* obj, *value) { QJsonObject element; - toJsonValue(NULL, obj, &element, innerType); + toJsonValue(nullptr, obj, &element, innerType); output->append(element); } } diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp index 5ab58d8f11..215482d885 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp @@ -60,7 +60,7 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q HttpRequestWorker::HttpRequestWorker(QObject *parent) - : QObject(parent), manager(NULL) + : QObject(parent), manager(nullptr) { qsrand(QDateTime::currentDateTime().toTime_t()); @@ -204,8 +204,8 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { // ensure necessary variables are available if ( - file_info->local_filename == NULL || file_info->local_filename.isEmpty() - || file_info->variable_name == NULL || file_info->variable_name.isEmpty() + file_info->local_filename == nullptr || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr || file_info->variable_name.isEmpty() || !fi.exists() || !fi.isFile() || !fi.isReadable() ) { // silent abort for the current file @@ -219,7 +219,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { } // ensure filename for the request - if (file_info->request_filename == NULL || file_info->request_filename.isEmpty()) { + if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { file_info->request_filename = fi.fileName(); if (file_info->request_filename.isEmpty()) { file_info->request_filename = "file"; @@ -238,7 +238,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { )); request_content.append(new_line); - if (file_info->mime_type != NULL && !file_info->mime_type.isEmpty()) { + if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { request_content.append("Content-Type: "); request_content.append(file_info->mime_type); request_content.append(new_line); diff --git a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h index beee860a6c..4e15dc0e8c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h +++ b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h @@ -54,19 +54,19 @@ namespace Swagger { return new User(); } - return NULL; + return nullptr; } inline void* create(QString json, QString type) { void* val = create(type); - if(val != NULL) { + if(val != nullptr) { SWGObject* obj = static_cast(val); return obj->fromJson(json); } if(type.startsWith("QString")) { return new QString(); } - return NULL; + return nullptr; } } /* namespace Swagger */ diff --git a/samples/client/petstore/qt5cpp/client/SWGObject.h b/samples/client/petstore/qt5cpp/client/SWGObject.h index e0b60b6fe1..98b428969c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGObject.h +++ b/samples/client/petstore/qt5cpp/client/SWGObject.h @@ -30,12 +30,12 @@ class SWGObject { public: virtual QJsonObject* asJsonObject() { - return NULL; + return nullptr; } virtual ~SWGObject() {} virtual SWGObject* fromJson(QString &jsonString) { Q_UNUSED(jsonString); - return NULL; + return nullptr; } virtual void fromJsonObject(QJsonObject &json) { Q_UNUSED(json); diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index a612d8718e..2f3f274b1f 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -40,7 +40,7 @@ SWGPetApi::SWGPetApi(QString host, QString basePath) { } void -SWGPetApi::addPet(Pet body) { +SWGPetApi::addPet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -81,12 +81,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) { emit addPetSignal(); } void -SWGPetApi::deletePet(qint64 petId, QString* apiKey) { +SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -197,14 +197,14 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { } - QList* output = new QList(); + QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - Pet* o = new Pet(); + SWGPet* o = new SWGPet(); QJsonObject jv = obj.toObject(); QJsonObject * ptr = (QJsonObject*)&jv; o->fromJsonObject(*ptr); @@ -293,14 +293,14 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { } - QList* output = new QList(); + QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - Pet* o = new Pet(); + SWGPet* o = new SWGPet(); QJsonObject jv = obj.toObject(); QJsonObject * ptr = (QJsonObject*)&jv; o->fromJsonObject(*ptr); @@ -315,12 +315,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { } void -SWGPetApi::getPetById(qint64 petId) { +SWGPetApi::getPetById(qint64 pet_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -350,7 +350,7 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) { QString json(worker->response); - Pet* output = static_cast(create(json, QString("Pet"))); + SWGPet* output = static_cast(create(json, QString("SWGPet"))); worker->deleteLater(); @@ -359,7 +359,7 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) { } void -SWGPetApi::updatePet(Pet body) { +SWGPetApi::updatePet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -400,21 +400,21 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) { emit updatePetSignal(); } void -SWGPetApi::updatePetWithForm(qint64 petId, QString* name, QString* status) { +SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - if (name != NULL) { + if (name != nullptr) { input.add_var("name", *name); } -if (status != NULL) { +if (status != nullptr) { input.add_var("status", *status); } @@ -447,21 +447,21 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) { emit updatePetWithFormSignal(); } void -SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file) { +SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - if (additionalMetadata != NULL) { - input.add_var("additionalMetadata", *additionalMetadata); + if (additional_metadata != nullptr) { + input.add_var("additionalMetadata", *additional_metadata); } -if (file != NULL) { +if (file != nullptr) { input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type); } @@ -488,7 +488,7 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { QString json(worker->response); - ApiResponse* output = static_cast(create(json, QString("ApiResponse"))); + SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); worker->deleteLater(); diff --git a/samples/client/petstore/qt5cpp/client/Tag.cpp b/samples/client/petstore/qt5cpp/client/Tag.cpp index 3ca68cfc92..8715022e87 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.cpp +++ b/samples/client/petstore/qt5cpp/client/Tag.cpp @@ -23,7 +23,7 @@ */ -#include "Tag.h" +#include "SWGTag.h" #include "SWGHelpers.h" @@ -35,35 +35,36 @@ namespace Swagger { -Tag::Tag(QString* json) { +SWGTag::SWGTag(QString* json) { init(); this->fromJson(*json); } -Tag::Tag() { +SWGTag::SWGTag() { init(); } -Tag::~Tag() { +SWGTag::~SWGTag() { this->cleanup(); } void -Tag::init() { +SWGTag::init() { id = 0L; -name = new QString(""); + name = new QString(""); } void -Tag::cleanup() { +SWGTag::cleanup() { -if(name != NULL) { + + if(name != nullptr) { delete name; } } -Tag* -Tag::fromJson(QString &json) { +SWGTag* +SWGTag::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -72,13 +73,13 @@ Tag::fromJson(QString &json) { } void -Tag::fromJsonObject(QJsonObject &pJson) { - setValue(&id, pJson["id"], "qint64", ""); -setValue(&name, pJson["name"], "QString", "QString"); +SWGTag::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&id, pJson["id"], "qint64", ""); + ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); } QString -Tag::asJson () +SWGTag::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -88,33 +89,31 @@ Tag::asJson () } QJsonObject* -Tag::asJsonObject() { +SWGTag::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("id", QJsonValue(id)); - toJsonValue(QString("name"), name, obj, QString("QString")); - - return obj; } qint64 -Tag::getId() { +SWGTag::getId() { return id; } void -Tag::setId(qint64 id) { +SWGTag::setId(qint64 id) { this->id = id; } QString* -Tag::getName() { +SWGTag::getName() { return name; } void -Tag::setName(QString* name) { +SWGTag::setName(QString* name) { this->name = name; } diff --git a/samples/client/petstore/qt5cpp/client/Tag.h b/samples/client/petstore/qt5cpp/client/Tag.h index 7359a74283..9c51827fdc 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.h +++ b/samples/client/petstore/qt5cpp/client/Tag.h @@ -56,12 +56,14 @@ public: qint64 getId(); void setId(qint64 id); -QString* getName(); + + QString* getName(); void setName(QString* name); + private: qint64 id; -QString* name; + QString* name; }; } /* namespace Swagger */ diff --git a/samples/client/petstore/qt5cpp/client/User.cpp b/samples/client/petstore/qt5cpp/client/User.cpp index 5fb2e21223..60d5f11310 100644 --- a/samples/client/petstore/qt5cpp/client/User.cpp +++ b/samples/client/petstore/qt5cpp/client/User.cpp @@ -23,7 +23,7 @@ */ -#include "User.h" +#include "SWGUser.h" #include "SWGHelpers.h" @@ -35,57 +35,63 @@ namespace Swagger { -User::User(QString* json) { +SWGUser::SWGUser(QString* json) { init(); this->fromJson(*json); } -User::User() { +SWGUser::SWGUser() { init(); } -User::~User() { +SWGUser::~SWGUser() { this->cleanup(); } void -User::init() { +SWGUser::init() { id = 0L; -username = new QString(""); -firstName = new QString(""); -lastName = new QString(""); -email = new QString(""); -password = new QString(""); -phone = new QString(""); -userStatus = 0; + username = new QString(""); + first_name = new QString(""); + last_name = new QString(""); + email = new QString(""); + password = new QString(""); + phone = new QString(""); + user_status = 0; } void -User::cleanup() { +SWGUser::cleanup() { -if(username != NULL) { + + if(username != nullptr) { delete username; } -if(firstName != NULL) { - delete firstName; + + if(first_name != nullptr) { + delete first_name; } -if(lastName != NULL) { - delete lastName; + + if(last_name != nullptr) { + delete last_name; } -if(email != NULL) { + + if(email != nullptr) { delete email; } -if(password != NULL) { + + if(password != nullptr) { delete password; } -if(phone != NULL) { + + if(phone != nullptr) { delete phone; } } -User* -User::fromJson(QString &json) { +SWGUser* +SWGUser::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -94,19 +100,19 @@ User::fromJson(QString &json) { } void -User::fromJsonObject(QJsonObject &pJson) { - setValue(&id, pJson["id"], "qint64", ""); -setValue(&username, pJson["username"], "QString", "QString"); -setValue(&firstName, pJson["firstName"], "QString", "QString"); -setValue(&lastName, pJson["lastName"], "QString", "QString"); -setValue(&email, pJson["email"], "QString", "QString"); -setValue(&password, pJson["password"], "QString", "QString"); -setValue(&phone, pJson["phone"], "QString", "QString"); -setValue(&userStatus, pJson["userStatus"], "qint32", ""); +SWGUser::fromJsonObject(QJsonObject &pJson) { + ::Swagger::setValue(&id, pJson["id"], "qint64", ""); + ::Swagger::setValue(&username, pJson["username"], "QString", "QString"); + ::Swagger::setValue(&first_name, pJson["first_name"], "QString", "QString"); + ::Swagger::setValue(&last_name, pJson["last_name"], "QString", "QString"); + ::Swagger::setValue(&email, pJson["email"], "QString", "QString"); + ::Swagger::setValue(&password, pJson["password"], "QString", "QString"); + ::Swagger::setValue(&phone, pJson["phone"], "QString", "QString"); + ::Swagger::setValue(&user_status, pJson["user_status"], "qint32", ""); } QString -User::asJson () +SWGUser::asJson () { QJsonObject* obj = this->asJsonObject(); @@ -116,114 +122,98 @@ User::asJson () } QJsonObject* -User::asJsonObject() { +SWGUser::asJsonObject() { QJsonObject* obj = new QJsonObject(); + obj->insert("id", QJsonValue(id)); - toJsonValue(QString("username"), username, obj, QString("QString")); - - - - toJsonValue(QString("firstName"), firstName, obj, QString("QString")); - - + toJsonValue(QString("first_name"), first_name, obj, QString("QString")); - - toJsonValue(QString("lastName"), lastName, obj, QString("QString")); - - + toJsonValue(QString("last_name"), last_name, obj, QString("QString")); - toJsonValue(QString("email"), email, obj, QString("QString")); - - - toJsonValue(QString("password"), password, obj, QString("QString")); - - - toJsonValue(QString("phone"), phone, obj, QString("QString")); - - -obj->insert("userStatus", QJsonValue(userStatus)); + + obj->insert("user_status", QJsonValue(user_status)); return obj; } qint64 -User::getId() { +SWGUser::getId() { return id; } void -User::setId(qint64 id) { +SWGUser::setId(qint64 id) { this->id = id; } QString* -User::getUsername() { +SWGUser::getUsername() { return username; } void -User::setUsername(QString* username) { +SWGUser::setUsername(QString* username) { this->username = username; } QString* -User::getFirstName() { - return firstName; +SWGUser::getFirstName() { + return first_name; } void -User::setFirstName(QString* firstName) { - this->firstName = firstName; +SWGUser::setFirstName(QString* first_name) { + this->first_name = first_name; } QString* -User::getLastName() { - return lastName; +SWGUser::getLastName() { + return last_name; } void -User::setLastName(QString* lastName) { - this->lastName = lastName; +SWGUser::setLastName(QString* last_name) { + this->last_name = last_name; } QString* -User::getEmail() { +SWGUser::getEmail() { return email; } void -User::setEmail(QString* email) { +SWGUser::setEmail(QString* email) { this->email = email; } QString* -User::getPassword() { +SWGUser::getPassword() { return password; } void -User::setPassword(QString* password) { +SWGUser::setPassword(QString* password) { this->password = password; } QString* -User::getPhone() { +SWGUser::getPhone() { return phone; } void -User::setPhone(QString* phone) { +SWGUser::setPhone(QString* phone) { this->phone = phone; } qint32 -User::getUserStatus() { - return userStatus; +SWGUser::getUserStatus() { + return user_status; } void -User::setUserStatus(qint32 userStatus) { - this->userStatus = userStatus; +SWGUser::setUserStatus(qint32 user_status) { + this->user_status = user_status; } diff --git a/samples/client/petstore/qt5cpp/client/User.h b/samples/client/petstore/qt5cpp/client/User.h index 06ef491356..ea8a129e24 100644 --- a/samples/client/petstore/qt5cpp/client/User.h +++ b/samples/client/petstore/qt5cpp/client/User.h @@ -23,13 +23,13 @@ */ /* - * User.h + * SWGUser.h * * A User who is purchasing from the pet store */ -#ifndef User_H_ -#define User_H_ +#ifndef SWGUser_H_ +#define SWGUser_H_ #include @@ -41,47 +41,55 @@ namespace Swagger { -class User: public SWGObject { +class SWGUser: public SWGObject { public: - User(); - User(QString* json); - virtual ~User(); + SWGUser(); + SWGUser(QString* json); + virtual ~SWGUser(); void init(); void cleanup(); QString asJson (); QJsonObject* asJsonObject(); void fromJsonObject(QJsonObject &json); - User* fromJson(QString &jsonString); + SWGUser* fromJson(QString &jsonString); qint64 getId(); void setId(qint64 id); -QString* getUsername(); + + QString* getUsername(); void setUsername(QString* username); -QString* getFirstName(); - void setFirstName(QString* firstName); -QString* getLastName(); - void setLastName(QString* lastName); -QString* getEmail(); + + QString* getFirstName(); + void setFirstName(QString* first_name); + + QString* getLastName(); + void setLastName(QString* last_name); + + QString* getEmail(); void setEmail(QString* email); -QString* getPassword(); + + QString* getPassword(); void setPassword(QString* password); -QString* getPhone(); + + QString* getPhone(); void setPhone(QString* phone); -qint32 getUserStatus(); - void setUserStatus(qint32 userStatus); + + qint32 getUserStatus(); + void setUserStatus(qint32 user_status); + private: qint64 id; -QString* username; -QString* firstName; -QString* lastName; -QString* email; -QString* password; -QString* phone; -qint32 userStatus; + QString* username; + QString* first_name; + QString* last_name; + QString* email; + QString* password; + QString* phone; + qint32 user_status; }; } /* namespace Swagger */ -#endif /* User_H_ */ +#endif /* SWGUser_H_ */ diff --git a/samples/server/petstore/nancyfx/IO.Swagger.sln b/samples/server/petstore/nancyfx/IO.Swagger.sln index 0a38b2ea77..46c91d37d0 100644 --- a/samples/server/petstore/nancyfx/IO.Swagger.sln +++ b/samples/server/petstore/nancyfx/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D198220E-91F6-402F-966F-8EF6105B1B75}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.Build.0 = Debug|Any CPU -{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.ActiveCfg = Release|Any CPU -{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.Build.0 = Release|Any CPU +{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU +{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = Release|Any CPU +{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj index 1d18142a14..4c1283eae3 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {D198220E-91F6-402F-966F-8EF6105B1B75} + {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1} Library Properties IO.Swagger.v2 diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/ApiResponse.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/ApiResponse.cs index 8eb4093841..3b8ad566af 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/ApiResponse.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/ApiResponse.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// ApiResponse + /// Describes the result of uploading an image resource /// public sealed class ApiResponse: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Category.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Category.cs index 759bedd74a..c6089446e5 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Category.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Category.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// Category + /// A category for a pet /// public sealed class Category: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Order.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Order.cs index 7404b48383..f1f94f39d7 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Order.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Order.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// Order + /// An order for a pets from the pet store /// public sealed class Order: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Pet.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Pet.cs index aef03f6ba9..b092feb9e8 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Pet.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Pet.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// Pet + /// A pet for sale in the pet store /// public sealed class Pet: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Tag.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Tag.cs index 36fd8204a8..94b15c123a 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Tag.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/Tag.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// Tag + /// A tag for a pet /// public sealed class Tag: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/User.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/User.cs index 69d079ff42..bd720290ad 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Models/User.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Models/User.cs @@ -8,7 +8,7 @@ using NodaTime; namespace IO.Swagger.v2.Models { /// - /// User + /// A User who is purchasing from the pet store /// public sealed class User: IEquatable { diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs index 954683f095..7f0e848f98 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs @@ -134,7 +134,7 @@ namespace IO.Swagger.v2.Utils private static IDictionary> CreateParsers() { var parsers = ImmutableDictionary.CreateBuilder>(); - parsers.Put(typeof(string), value => value); + parsers.Put(typeof(string), value => value.Value); parsers.Put(typeof(bool), SafeParse(bool.Parse)); parsers.Put(typeof(bool?), SafeParse(bool.Parse)); parsers.Put(typeof(byte), SafeParse(byte.Parse)); @@ -411,4 +411,4 @@ namespace IO.Swagger.v2.Utils Path, Header } -} \ No newline at end of file +} diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java index 2bdbadca1f..37752be921 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java index 8c76fdef56..11bbcebb0d 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java index 8d309ccf89..7297000023 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java @@ -15,7 +15,7 @@ import java.util.Date; **/ @ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java index da6af3805e..6b2e4693ea 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java @@ -18,7 +18,7 @@ import java.util.List; **/ @ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java index c404fabc9b..b713c9d3f9 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java index bafd066363..a543df663c 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") public class User { private Long id = null;