\r
cJSON *jsonAdditionalProperties = cJSON_GetObjectItem(m_cjson, "additionalProperties");\r
if (jsonAdditionalProperties)\r
- m_additionalProperties = jsonAdditionalProperties->type;\r
+ m_additionalProperties = (jsonAdditionalProperties->type == cJSON_True);\r
else\r
- m_additionalProperties = cJSON_True;\r
+ m_additionalProperties = true;\r
\r
cJSON *jsonReference = cJSON_GetObjectItem(m_cjson, "$ref");\r
if (jsonReference)\r
std::string attType;\r
if (propertyType)\r
{\r
- if (propertyType->type == 4)\r
+ if (propertyType->type == cJSON_String)\r
{\r
attType = propertyType->valuestring;\r
}\r
- else if (propertyType->type == 5)\r
+ else if (propertyType->type == cJSON_Array)\r
{\r
attType = cJSON_GetArrayItem(propertyType, 0)->valuestring;\r
}\r
void JsonSchema::readDefaultValue(cJSON *defaultValue, PropertiesPtr &property,\r
const std::string &attType)\r
{\r
- if (defaultValue->type == 4)\r
+ if (defaultValue->type == cJSON_String)\r
{\r
property->setValue((std::string)defaultValue->valuestring);\r
}\r
- else if (defaultValue->type == 3)\r
+ else if (defaultValue->type == cJSON_Number)\r
{\r
if (attType == "number")\r
property->setValue((double)defaultValue->valuedouble);\r
else\r
property->setValue((int)defaultValue->valueint );\r
}\r
- else if (defaultValue->type == 1)\r
+ else if (defaultValue->type == cJSON_True)\r
{\r
property->setValue((bool)true);\r
}\r
- else if (defaultValue->type == 0)\r
+ else if (defaultValue->type == cJSON_False)\r
{\r
property->setValue((bool)false);\r
}\r
void JsonSchema::readAllowedValues(cJSON *allowedvalues, PropertiesPtr &property,\r
std::string &attType)\r
{\r
- if ((cJSON_GetArrayItem(allowedvalues, 0)->type) == 4)\r
+ if ((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_String)\r
{\r
int size = cJSON_GetArraySize(allowedvalues);\r
int idx = 0;\r
if (attType.empty())\r
attType = "string";\r
}\r
- else if ((cJSON_GetArrayItem(allowedvalues, 0)->type) == 3)\r
+ else if ((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_Number)\r
{\r
int size = cJSON_GetArraySize(allowedvalues);\r
int idx = 0;\r
attType = "integer";\r
}\r
}\r
- else if (((cJSON_GetArrayItem(allowedvalues, 0)->type) == 1)\r
- || ((cJSON_GetArrayItem(allowedvalues, 0)->type) == 0))\r
+ else if (((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_True)\r
+ || ((cJSON_GetArrayItem(allowedvalues, 0)->type) == cJSON_False))\r
{\r
int size = cJSON_GetArraySize(allowedvalues);\r
int idx = 0;\r
std::vector<bool> allwdValues;\r
do\r
{\r
- if (cJSON_GetArrayItem(allowedvalues, idx)->type)\r
+ if (cJSON_GetArrayItem(allowedvalues, idx)->type != cJSON_False)\r
allwdValues.push_back(true);\r
else\r
allwdValues.push_back(false);\r
cJSON *itemValues = cJSON_GetObjectItem(childProperties, "items");\r
if (itemValues)\r
{\r
- if (itemValues->type == 5)\r
+ if (itemValues->type == cJSON_Array)\r
{\r
//int item_size = cJSON_GetArraySize(itemValues);\r
int item_index = 0;\r
}\r
cJSON *itemsMax = cJSON_GetObjectItem(childProperties, "maxItems");\r
int min = INT_MIN, max = INT_MAX;\r
- bool unique = cJSON_False, addItems = cJSON_False;\r
+ bool unique = false, addItems = false;\r
if (itemsMax)\r
{\r
cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");\r
cJSON *uniqueItems = cJSON_GetObjectItem(childProperties, "uniqueItems");\r
if (uniqueItems)\r
{\r
- unique = uniqueItems->type;\r
+ unique = (uniqueItems->type == cJSON_True);\r
}\r
cJSON *additionalItems = cJSON_GetObjectItem(childProperties, "additionalItems");\r
if (additionalItems)\r
{\r
- addItems = additionalItems->type;\r
+ addItems = (additionalItems->type == cJSON_True);\r
}\r
property->setValueProperty(std::make_shared<ValueProperty>\r
(ValueProperty::Type::ARRAY, min, max, unique, addItems));\r