I am trying to test a JSON scheme using TV4 .
My check uses hierarchical JSON and is based on this basic example :
var data = {
"foo": "bar"
};
var schema = {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
},
"required": ["foo"]
};
var result = tv4.validateResult(data, schema);
In my test, I want to add another level of hierarchy:
var data = {
"foo": {
"test": "bar"
}
};
var schema = {
"type": "object",
"properties": {
"foo": {
"test": {
"type": "string"
}
}
},
"required": ["foo"]
};
var result = tv4.validateResult(data, schema);
This check does not work (if I put an integer instead of a string, it passes validation )
What am I doing wrong here?
source
share