Created
November 16, 2011 12:41
-
-
Save sfentress/1369981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schema = { | |
"properties": { | |
"topPane": { | |
"$ref": "paneSchema" // referring directly by a new id, not #/paneSchema | |
}, | |
"bottomPane": { | |
"$ref": "paneSchema" | |
} | |
}, | |
"paneSchema": { | |
"properties": { | |
"height": { | |
"type": "number" | |
} | |
} | |
} | |
}; | |
doc = { | |
"topPane": { | |
"height": 10 | |
}, | |
"bottomPane": { | |
"height": "not-a-number" | |
} | |
}; | |
env = JSV.createEnvironment(); | |
env.createSchema(schema.paneSchema, schema, "paneSchema"); // this is the key | |
report = env.validate(doc, schema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment