Do you want to contribute with this project? Contact me: bw.bwctm@gmail.com
##Code example:
var jsonschema = require('jsjsonschema');
var article = {
"$ref$": "article_1",
"title": "This is an Article",
"page": "ref(page_1)",
"other": {
"something": "ref(article_1)"
}
};
var page = {
"$ref$": "page_1",
"title": "This is a page"
};
var articleSchema = {
"id": "/ArticleSchema",
"type": "object",
"properties": {
"title": {
"type": "integer"
},
"page": {
"type": "integer",
"$ref$": "($ref$)"
},
"other": {
"properties": {
"something": {
"type": "string",
"$ref$": "($ref$)"
}
}
}
}
};
var pageSchema = {
"id": "/PageSchema",
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
};
jsonschema.addSchema('/ArticleSchema', articleSchema);
jsonschema.addSchema('/PageSchema', pageSchema);
jsonschema.addValidate('/ArticleSchema', article, 'article');
jsonschema.addValidate('/PageSchema', page, 'page');
jsonschema.start();
console.log(jsonschema.getErrors());