6#include <PhosphorFsLoader/phosphorfsloader_export.h>
8#include <QtCore/QByteArray>
9#include <QtCore/QJsonValue>
10#include <QtCore/QList>
11#include <QtCore/QString>
16class QLoggingCategory;
90 [[nodiscard]] std::optional<QList<
Error>>
validate(const QJsonValue& document) const;
94 std::unique_ptr<Private> d;
Validates parsed JSON documents against a JSON Schema (Draft 7).
Definition SchemaValidator.h:38
static SchemaValidator fromResource(const QString &resourcePath, const QLoggingCategory &category)
Build a validator from a Qt resource (or file) path, failing closed.
bool isValid() const
True when the schema compiled successfully and the validator is usable.
std::optional< QList< Error > > validate(const QJsonValue &document) const
Validate a parsed JSON document against the compiled schema.
SchemaValidator(const QByteArray &schemaJson)
Compile a JSON Schema from its serialized bytes.
SchemaValidator(SchemaValidator &&) noexcept
Definition ContainedFileReader.h:15
PHOSPHORFSLOADER_EXPORT void logSchemaErrors(const QLoggingCategory &category, const QList< SchemaValidator::Error > &errors)
Log each schema violation at category, one per line.
A single schema violation.
Definition SchemaValidator.h:42
QString message
Human-readable description of why the node failed.
Definition SchemaValidator.h:49
QString path
JSON Pointer to the node that failed validation (e.g.
Definition SchemaValidator.h:46