mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
@@ -11,6 +11,7 @@
|
||||
{
|
||||
"level" :
|
||||
{
|
||||
"type" : "string",
|
||||
"enum" : ["silent", "warn", "verbose", "debug"],
|
||||
"title" : "Log-Level"
|
||||
}
|
||||
@@ -747,6 +748,7 @@
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"format": "checkbox",
|
||||
"title" : "Activate"
|
||||
},
|
||||
"port" :
|
||||
@@ -774,6 +776,7 @@
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"format": "checkbox",
|
||||
"title" : "Activate"
|
||||
},
|
||||
"address" :
|
||||
@@ -802,6 +805,7 @@
|
||||
"shared" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"format": "checkbox",
|
||||
"title" : "Shared"
|
||||
}
|
||||
},
|
||||
@@ -817,6 +821,7 @@
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"format": "checkbox",
|
||||
"title" : "Activate",
|
||||
"required" : true
|
||||
},
|
||||
@@ -829,7 +834,7 @@
|
||||
"port" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"description" : "Port",
|
||||
"title" : "Port",
|
||||
"required" : true
|
||||
}
|
||||
},
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <math.h>
|
||||
|
||||
// Utils-Jsonschema includes
|
||||
#include <utils/jsonschema/QJsonSchemaChecker.h>
|
||||
@@ -45,9 +45,9 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
// check the current json value
|
||||
for (QJsonObject::const_iterator i = schema.begin(); i != schema.end(); ++i)
|
||||
{
|
||||
QString attribute = i.key();
|
||||
QString attribute = i.key();
|
||||
const QJsonValue & attributeValue = *i;
|
||||
|
||||
|
||||
if (attribute == "type")
|
||||
checkType(value, attributeValue);
|
||||
else if (attribute == "properties")
|
||||
@@ -71,7 +71,7 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
const QJsonObject & props = schema["properties"].toObject();
|
||||
ignoredProperties = props.keys();
|
||||
}
|
||||
|
||||
|
||||
checkAdditionalProperties(value.toObject(), attributeValue, ignoredProperties);
|
||||
}
|
||||
else
|
||||
@@ -108,7 +108,7 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
; // nothing to do. value is present so always oke
|
||||
else if (attribute == "id")
|
||||
; // references have already been collected
|
||||
else if (attribute == "title" || attribute == "description" || attribute == "default")
|
||||
else if (attribute == "title" || attribute == "description" || attribute == "default" || attribute == "format")
|
||||
; // nothing to do.
|
||||
else
|
||||
{
|
||||
@@ -135,7 +135,7 @@ const std::list<std::string> & QJsonSchemaChecker::getMessages() const
|
||||
void QJsonSchemaChecker::checkType(const QJsonValue & value, const QJsonValue & schema)
|
||||
{
|
||||
QString type = schema.toString();
|
||||
|
||||
|
||||
bool wrongType = false;
|
||||
if (type == "string")
|
||||
wrongType = !value.isString();
|
||||
@@ -168,16 +168,16 @@ void QJsonSchemaChecker::checkType(const QJsonValue & value, const QJsonValue &
|
||||
}
|
||||
|
||||
void QJsonSchemaChecker::checkProperties(const QJsonObject & value, const QJsonObject & schema)
|
||||
{
|
||||
{
|
||||
for (QJsonObject::const_iterator i = schema.begin(); i != schema.end(); ++i)
|
||||
{
|
||||
QString property = i.key();
|
||||
|
||||
|
||||
const QJsonValue & propertyValue = i.value();
|
||||
|
||||
_currentPath.push_back(std::string(".") + property.toStdString());
|
||||
QJsonObject::const_iterator required = propertyValue.toObject().find("required");
|
||||
|
||||
|
||||
if (value.contains(property))
|
||||
{
|
||||
validate(value[property], propertyValue.toObject());
|
||||
@@ -264,7 +264,7 @@ void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject
|
||||
setMessage("items only valid for arrays");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QJsonArray jArray = value.toArray();
|
||||
for(int i = 0; i < jArray.size(); ++i)
|
||||
{
|
||||
|
Reference in New Issue
Block a user