Introduce JSON validation

Support basic validation for JSON files according to the
draft http://tools.ietf.org/html/draft-zyp-json-schema-03.

This is not a complete implementation yet, but it should
already be useful, since "type" verification along with
many of the attributes is done.

Change-Id: I364bc98dd92937c5e2ea9cba7e15ed8e03eb9beb
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
Leandro Melo
2012-02-07 15:30:33 +01:00
parent 454e2c3928
commit 26b783ff02
11 changed files with 1738 additions and 11 deletions

View File

@@ -114,7 +114,19 @@ enum Type
WarnNumberConstructor = 308,
HintBinaryOperatorSpacing = 309,
WarnUnintentinalEmptyBlock = 310,
HintPreferNonVarPropertyType = 311
HintPreferNonVarPropertyType = 311,
ErrMissingRequiredProperty = 312,
ErrObjectValueExpected = 313,
ErrArrayValueExpected = 314,
ErrDifferentValueExpected = 315,
ErrSmallerNumberValueExpected = 316,
ErrLargerNumberValueExpected = 317,
ErrMaximumNumberValueIsExclusive = 318,
ErrMinimumNumberValueIsExclusive = 319,
ErrInvalidStringValuePattern = 320,
ErrLongerStringValueExpected = 321,
ErrShorterStringValueExpected = 322,
ErrInvalidArrayValueLength = 323
};
class QMLJS_EXPORT Message
@@ -123,7 +135,8 @@ public:
Message();
Message(Type type, AST::SourceLocation location,
const QString &arg1 = QString(),
const QString &arg2 = QString());
const QString &arg2 = QString(),
bool appendTypeId = true);
static QList<Type> allMessageTypes();