1.1.7 • Published 7 years ago

jsjsonschema v1.1.7

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Javascript JSON Schema

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());
1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago