Esempio n. 1
0
 void JsonSchema::readString(cJSON *childProperties, PropertiesPtr property)
 {
     cJSON *stringMax = cJSON_GetObjectItem(childProperties, "maxLength");
     if (stringMax)
     {
         cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");
         if (exclusiveMax)
         {
             if (exclusiveMax->type == cJSON_True)
                 property->setMax (--(stringMax->valueint));
             else
                 property->setMax(stringMax->valueint);
         }
         else
             property->setMax(stringMax->valueint);
     }
     cJSON *stringMin = cJSON_GetObjectItem(childProperties, "minLength");
     if (stringMin)
     {
         cJSON *exclusiveMin = cJSON_GetObjectItem(childProperties, "exclusiveMinimum");
         if (exclusiveMin)
         {
             if (exclusiveMin->type == cJSON_True)
                 property->setMin( ++(stringMin->valueint));
             else
                 property->setMin(stringMin->valueint);
         }
         else
             property->setMin(stringMin->valueint);
     }
     cJSON *stringFormat = cJSON_GetObjectItem(childProperties, "format");
     if (stringFormat)
     {
         property->setFormat(stringFormat->valuestring);
     }
     cJSON *stringPattern = cJSON_GetObjectItem(childProperties, "pattern");
     if (stringPattern)
     {
         property->setPattern(stringPattern->valuestring);
     }
 }