Created
September 6, 2013 16:09
-
-
Save justinanderson/6466049 to your computer and use it in GitHub Desktop.
This is an example of how JSON schema allows for deceptive schema. bad-schema.json looks like it requires an array to contain only strings, but in truth it only checks the first element of the array, so both bad.json and good.json validate against bad-schema.json. good-schema.json validates every element of the array, so good.json validates agai…
This file contains hidden or 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
| { | |
| "type": "array", | |
| "items": [ | |
| { | |
| "type": "string" | |
| } | |
| ] | |
| } |
This file contains hidden or 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
| [ | |
| "1", 5, null | |
| ] |
This file contains hidden or 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
| { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| } | |
| } |
This file contains hidden or 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
| [ | |
| "1", "5", "null" | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment