Why this example of referencing schema inside same object does not work?
Opened this issue · 0 comments
Deleted user commented
sch = {
type: 'object',
"properties": {
"str1": {
"type": "string",
"id": "#strref"
},
"str2": {
$ref: '#strref'
}
}
};
obj = {
str1: 'sss',
str2: 21
};
schema = require('json-schema');
console.dir(schema.validate(obj, sch));
Returns { valid: true, errors: [] }.
But str2 isn't string