mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
feat: SchemaChecker & V4L2 enhancement (#734)
* libjpeg-turbo, QJsonSchemaChecker, V4L2 width/height/fps Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Implement hyperion-v4l cli args * Apply v4l2 settings during runtime * feat: Provide minimum values for input restriction * fix: merge mess Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
@@ -73,7 +73,7 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
QJsonObject::const_iterator defaultValue = schema.find("default");
|
||||
|
||||
if (attribute == "type")
|
||||
checkType(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkType(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "properties")
|
||||
{
|
||||
if (value.isObject())
|
||||
@@ -106,13 +106,13 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
}
|
||||
}
|
||||
else if (attribute == "minimum")
|
||||
checkMinimum(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMinimum(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "maximum")
|
||||
checkMaximum(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMaximum(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "minLength")
|
||||
checkMinLength(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMinLength(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "maxLength")
|
||||
checkMaxLength(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMaxLength(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "items")
|
||||
{
|
||||
if (value.isArray())
|
||||
@@ -125,19 +125,20 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
}
|
||||
}
|
||||
else if (attribute == "minItems")
|
||||
checkMinItems(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMinItems(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "maxItems")
|
||||
checkMaxItems(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkMaxItems(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "uniqueItems")
|
||||
checkUniqueItems(value, attributeValue);
|
||||
else if (attribute == "enum")
|
||||
checkEnum(value, attributeValue, (defaultValue != schema.end() ? defaultValue.value() : QJsonValue::Null));
|
||||
checkEnum(value, attributeValue, (defaultValue != schema.end() ? *defaultValue : QJsonValue::Null));
|
||||
else if (attribute == "required")
|
||||
; // 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" || attribute == "format"
|
||||
|| attribute == "defaultProperties" || attribute == "propertyOrder" || attribute == "append" || attribute == "step" || attribute == "access" || attribute == "options" || attribute == "script")
|
||||
|| attribute == "defaultProperties" || attribute == "propertyOrder" || attribute == "append" || attribute == "step"
|
||||
|| attribute == "access" || attribute == "options" || attribute == "script" || attribute == "allowEmptyArray")
|
||||
; // nothing to do.
|
||||
else
|
||||
{
|
||||
@@ -225,7 +226,7 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject & value, const QJsonO
|
||||
if (_correct == "create")
|
||||
{
|
||||
QJsonUtils::modify(_autoCorrected, _currentPath, QJsonUtils::create(propertyValue, _ignoreRequired), property);
|
||||
setMessage("Create property: "+property+" with value: "+propertyValue.toObject().find("default").value().toString());
|
||||
setMessage("Create property: "+property+" with value: "+QJsonUtils::getDefaultValue(propertyValue));
|
||||
}
|
||||
|
||||
if (_correct == "")
|
||||
@@ -391,7 +392,7 @@ void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject
|
||||
QJsonArray jArray = value.toArray();
|
||||
|
||||
if (_correct == "remove")
|
||||
if (jArray.isEmpty())
|
||||
if (jArray.isEmpty() && !schema.contains("allowEmptyArray"))
|
||||
{
|
||||
QJsonUtils::modify(_autoCorrected, _currentPath);
|
||||
setMessage("Remove empty array");
|
||||
|
Reference in New Issue
Block a user