Squashed commit of the following:

commit c5a0d0f7394aa742fa336fff7e7c1d3049761868
Merge: 8c4991ba3e f8ff8c8760
Author: William Cheng <wing328hk@gmail.com>
Date:   Tue Aug 17 18:28:12 2021 +0800

    Merge branch 'mustache-linting' of https://github.com/NathanBaulch/openapi-generator into NathanBaulch-mustache-linting

commit f8ff8c8760
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:12:47 2021 +1000

    Reorder tags that handle missing values

commit f5d8a33709
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:08:59 2021 +1000

    Use dot notation where possible

commit 493d14921e
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:10:49 2021 +1000

    Remove empty tags

commit 32480dc53f
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 10:41:58 2021 +1000

    Remove redundant sections

commit a8edabd722
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 22:02:22 2021 +1000

    Trim extra EOF new lines

commit e89bd7458e
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 21:59:26 2021 +1000

    Trim trailing whitespace
This commit is contained in:
William Cheng
2021-08-17 18:37:51 +08:00
parent 7edddb6531
commit 0204bf4ae2
2184 changed files with 6677 additions and 7219 deletions

View File

@@ -23,43 +23,43 @@ ApiResponse::~ApiResponse()
void
ApiResponse::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *codeKey = "code";
if(object.has_key(codeKey))
if(object.has_key(codeKey))
{
bourne::json value = object[codeKey];
jsonToValue(&code, value, "int");
}
const char *typeKey = "type";
if(object.has_key(typeKey))
if(object.has_key(typeKey))
{
bourne::json value = object[typeKey];
jsonToValue(&type, value, "std::string");
}
const char *messageKey = "message";
if(object.has_key(messageKey))
if(object.has_key(messageKey))
{
bourne::json value = object[messageKey];
jsonToValue(&message, value, "std::string");
@@ -73,21 +73,21 @@ ApiResponse::toJson()
{
bourne::json object = bourne::json::object();
object["code"] = getCode();
object["type"] = getType();

View File

@@ -22,30 +22,30 @@ Category::~Category()
void
Category::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *idKey = "id";
if(object.has_key(idKey))
if(object.has_key(idKey))
{
bourne::json value = object[idKey];
jsonToValue(&id, value, "long");
}
const char *nameKey = "name";
if(object.has_key(nameKey))
if(object.has_key(nameKey))
{
bourne::json value = object[nameKey];
jsonToValue(&name, value, "std::string");
@@ -59,14 +59,14 @@ Category::toJson()
{
bourne::json object = bourne::json::object();
object["id"] = getId();

View File

@@ -23,39 +23,39 @@ jsonToValue(void* target, bourne::json value, std::string type)
{
if (target == NULL || value.is_null()) {
return;
}
else if (type.compare("bool") == 0)
}
else if (type.compare("bool") == 0)
{
bool* val = static_cast<bool*> (target);
*val = value.to_bool();
}
else if (type.compare("int") == 0)
}
else if (type.compare("int") == 0)
{
int* val = static_cast<int*> (target);
*val = value.to_int();
}
else if (type.compare("float") == 0)
}
else if (type.compare("float") == 0)
{
float* val = static_cast<float*> (target);
*val = (float)(value.to_float());
}
}
else if (type.compare("long") == 0)
{
long* val = static_cast<long*> (target);
*val = (long)(value.to_int());
}
else if (type.compare("double") == 0)
}
else if (type.compare("double") == 0)
{
double* val = static_cast<double*> (target);
*val = value.to_float();
}
else if (type.compare("std::string") == 0)
}
else if (type.compare("std::string") == 0)
{
std::string* val = static_cast<std::string*> (target);
*val = value.to_string();

View File

@@ -19,4 +19,3 @@ std::string stringify(float input);
std::string stringify(std::string input);
#endif /* TINY_CPP_CLIENT_HELPERS_H_ */

View File

@@ -26,82 +26,82 @@ Order::~Order()
void
Order::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *idKey = "id";
if(object.has_key(idKey))
if(object.has_key(idKey))
{
bourne::json value = object[idKey];
jsonToValue(&id, value, "long");
}
const char *petIdKey = "petId";
if(object.has_key(petIdKey))
if(object.has_key(petIdKey))
{
bourne::json value = object[petIdKey];
jsonToValue(&petId, value, "long");
}
const char *quantityKey = "quantity";
if(object.has_key(quantityKey))
if(object.has_key(quantityKey))
{
bourne::json value = object[quantityKey];
jsonToValue(&quantity, value, "int");
}
const char *shipDateKey = "shipDate";
if(object.has_key(shipDateKey))
if(object.has_key(shipDateKey))
{
bourne::json value = object[shipDateKey];
jsonToValue(&shipDate, value, "std::string");
}
const char *statusKey = "status";
if(object.has_key(statusKey))
if(object.has_key(statusKey))
{
bourne::json value = object[statusKey];
jsonToValue(&status, value, "std::string");
}
const char *completeKey = "complete";
if(object.has_key(completeKey))
if(object.has_key(completeKey))
{
bourne::json value = object[completeKey];
jsonToValue(&complete, value, "bool");
@@ -115,42 +115,42 @@ Order::toJson()
{
bourne::json object = bourne::json::object();
object["id"] = getId();
object["petId"] = getPetId();
object["quantity"] = getQuantity();
object["shipDate"] = getShipDate();
object["status"] = getStatus();

View File

@@ -26,30 +26,30 @@ Pet::~Pet()
void
Pet::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *idKey = "id";
if(object.has_key(idKey))
if(object.has_key(idKey))
{
bourne::json value = object[idKey];
jsonToValue(&id, value, "long");
}
const char *categoryKey = "category";
if(object.has_key(categoryKey))
if(object.has_key(categoryKey))
{
bourne::json value = object[categoryKey];
Category* obj = &category;
obj->fromJson(value.dump());
@@ -57,21 +57,21 @@ Pet::fromJson(std::string jsonObj)
}
const char *nameKey = "name";
if(object.has_key(nameKey))
if(object.has_key(nameKey))
{
bourne::json value = object[nameKey];
jsonToValue(&name, value, "std::string");
}
const char *photoUrlsKey = "photoUrls";
if(object.has_key(photoUrlsKey))
if(object.has_key(photoUrlsKey))
{
bourne::json value = object[photoUrlsKey];
@@ -82,8 +82,8 @@ Pet::fromJson(std::string jsonObj)
{
jsonToValue(&element, var, "std::string");
photoUrls_list.push_back(element);
}
photoUrls = photoUrls_list;
@@ -92,8 +92,8 @@ Pet::fromJson(std::string jsonObj)
}
const char *tagsKey = "tags";
if(object.has_key(tagsKey))
if(object.has_key(tagsKey))
{
bourne::json value = object[tagsKey];
@@ -103,9 +103,9 @@ Pet::fromJson(std::string jsonObj)
for(auto& var : value.array_range())
{
element.fromJson(var.dump());
tags_list.push_back(element);
}
tags = tags_list;
@@ -114,13 +114,13 @@ Pet::fromJson(std::string jsonObj)
}
const char *statusKey = "status";
if(object.has_key(statusKey))
if(object.has_key(statusKey))
{
bourne::json value = object[statusKey];
jsonToValue(&status, value, "std::string");
@@ -134,30 +134,30 @@ Pet::toJson()
{
bourne::json object = bourne::json::object();
object["id"] = getId();
object["category"] = getCategory().toJson();
object["name"] = getName();
std::list<std::string> photoUrls_list = getPhotoUrls();
bourne::json photoUrls_arr = bourne::json::array();
@@ -167,12 +167,12 @@ Pet::toJson()
}
object["photoUrls"] = photoUrls_arr;
std::list<Tag> tags_list = getTags();
bourne::json tags_arr = bourne::json::array();
@@ -186,7 +186,7 @@ Pet::toJson()

View File

@@ -22,30 +22,30 @@ Tag::~Tag()
void
Tag::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *idKey = "id";
if(object.has_key(idKey))
if(object.has_key(idKey))
{
bourne::json value = object[idKey];
jsonToValue(&id, value, "long");
}
const char *nameKey = "name";
if(object.has_key(nameKey))
if(object.has_key(nameKey))
{
bourne::json value = object[nameKey];
jsonToValue(&name, value, "std::string");
@@ -59,14 +59,14 @@ Tag::toJson()
{
bourne::json object = bourne::json::object();
object["id"] = getId();

View File

@@ -28,108 +28,108 @@ User::~User()
void
User::fromJson(std::string jsonObj)
{
{
bourne::json object = bourne::json::parse(jsonObj);
const char *idKey = "id";
if(object.has_key(idKey))
if(object.has_key(idKey))
{
bourne::json value = object[idKey];
jsonToValue(&id, value, "long");
}
const char *usernameKey = "username";
if(object.has_key(usernameKey))
if(object.has_key(usernameKey))
{
bourne::json value = object[usernameKey];
jsonToValue(&username, value, "std::string");
}
const char *firstNameKey = "firstName";
if(object.has_key(firstNameKey))
if(object.has_key(firstNameKey))
{
bourne::json value = object[firstNameKey];
jsonToValue(&firstName, value, "std::string");
}
const char *lastNameKey = "lastName";
if(object.has_key(lastNameKey))
if(object.has_key(lastNameKey))
{
bourne::json value = object[lastNameKey];
jsonToValue(&lastName, value, "std::string");
}
const char *emailKey = "email";
if(object.has_key(emailKey))
if(object.has_key(emailKey))
{
bourne::json value = object[emailKey];
jsonToValue(&email, value, "std::string");
}
const char *passwordKey = "password";
if(object.has_key(passwordKey))
if(object.has_key(passwordKey))
{
bourne::json value = object[passwordKey];
jsonToValue(&password, value, "std::string");
}
const char *phoneKey = "phone";
if(object.has_key(phoneKey))
if(object.has_key(phoneKey))
{
bourne::json value = object[phoneKey];
jsonToValue(&phone, value, "std::string");
}
const char *userStatusKey = "userStatus";
if(object.has_key(userStatusKey))
if(object.has_key(userStatusKey))
{
bourne::json value = object[userStatusKey];
jsonToValue(&userStatus, value, "int");
@@ -143,56 +143,56 @@ User::toJson()
{
bourne::json object = bourne::json::object();
object["id"] = getId();
object["username"] = getUsername();
object["firstName"] = getFirstName();
object["lastName"] = getLastName();
object["email"] = getEmail();
object["password"] = getPassword();
object["phone"] = getPhone();