mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Hyperion Switcher + cleanup (#423)
* upd * update * update * update schemachecker * ... * fix lowest priority * zeroconf updates (#421) (#3) * zeroconf: add ip make names more uniq * tune dns name for webconfig * update * update * update * update ui * ... * min val for gamma * lost somewhere this * add status to hyperion object * update ui
This commit is contained in:
@@ -85,6 +85,10 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
checkMinimum(value, attributeValue);
|
||||
else if (attribute == "maximum")
|
||||
checkMaximum(value, attributeValue);
|
||||
else if (attribute == "minLength")
|
||||
checkMinLength(value, attributeValue);
|
||||
else if (attribute == "maxLength")
|
||||
checkMaxLength(value, attributeValue);
|
||||
else if (attribute == "items")
|
||||
{
|
||||
if (value.isArray())
|
||||
@@ -250,6 +254,40 @@ void QJsonSchemaChecker::checkMaximum(const QJsonValue & value, const QJsonValue
|
||||
}
|
||||
}
|
||||
|
||||
void QJsonSchemaChecker::checkMinLength(const QJsonValue & value, const QJsonValue & schema)
|
||||
{
|
||||
if (!value.isString())
|
||||
{
|
||||
// only for Strings
|
||||
_error = true;
|
||||
setMessage("minLength check only for string fields");
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.toString().size() < schema.toInt())
|
||||
{
|
||||
_error = true;
|
||||
setMessage("value is too short (minLength=" + schema.toString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
void QJsonSchemaChecker::checkMaxLength(const QJsonValue & value, const QJsonValue & schema)
|
||||
{
|
||||
if (!value.isString())
|
||||
{
|
||||
// only for Strings
|
||||
_error = true;
|
||||
setMessage("maxLength check only for string fields");
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.toString().size() > schema.toInt())
|
||||
{
|
||||
_error = true;
|
||||
setMessage("value is too long (maxLength=" + schema.toString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject & schema)
|
||||
{
|
||||
if (!value.isArray())
|
||||
|
Reference in New Issue
Block a user