Skip to content

extended tests for json-pointer format #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 140 additions & 10 deletions tests/draft6/optional/format.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
]
},
{
"description": "validation of JSON-pointers",
"description": "validation of JSON-pointers (JSON String Representation)",
"schema": {"format": "json-pointer"},
"tests": [
{
Expand All @@ -229,29 +229,159 @@
"valid": true
},
{
"description": "empty string is valid",
"description": "not a valid JSON-pointer (~ not escaped)",
"data": "/foo/bar~",
"valid": false
},
{
"description": "valid JSON-pointer with empty segment",
"data": "/foo//bar",
"valid": true
},
{
"description": "valid JSON-pointer with the last empty segment",
"data": "/foo/bar/",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #1",
"data": "",
"valid": true
},
{
"description": "/ is valid",
"description": "valid JSON-pointer as stated in RFC 6901 #2",
"data": "/foo",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #3",
"data": "/foo/0",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #4",
"data": "/",
"valid": true
},
{
"description": "not a valid JSON-pointer (~ not escaped)",
"data": "/foo/bar~",
"valid": false
"description": "valid JSON-pointer as stated in RFC 6901 #5",
"data": "/a~1b",
"valid": true
},
{
"description": "valid JSON-pointer with empty segment",
"data": "/foo//bar",
"description": "valid JSON-pointer as stated in RFC 6901 #6",
"data": "/c%d",
"valid": true
},
{
"description": "valid JSON-pointer with the last empty segment",
"data": "/foo/bar/",
"description": "valid JSON-pointer as stated in RFC 6901 #7",
"data": "/e^f",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #8",
"data": "/g|h",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #9",
"data": "/i\\j",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #10",
"data": "/k\"l",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #11",
"data": "/ ",
"valid": true
},
{
"description": "valid JSON-pointer as stated in RFC 6901 #12",
"data": "/m~0n",
"valid": true
},
{
"description": "valid JSON-pointer used to add something to the last position of an array",
"data": "/foo/-",
"valid": true
},
{
"description": "valid JSON-pointer (- used as object member name)",
"data": "/foo/-/bar",
"valid": true
},
{
"description": "valid JSON-pointer (multiple escaped characters)",
"data": "/~1~0~0~1~1",
"valid": true
},
{
"description": "valid JSON-pointer (escaped characters with fraction part) #1",
"data": "/~1.1",
"valid": true
},
{
"description": "valid JSON-pointer (escaped characters with fraction part) #2",
"data": "/~0.1",
"valid": true
},
{
"description": "not a valid JSON-pointer (URI Fragment Identifier Representation) #1",
"data": "#",
"valid": false
},
{
"description": "not a valid JSON-pointer (URI Fragment Identifier Representation) #2",
"data": "#/",
"valid": false
},
{
"description": "not a valid JSON-pointer (URI Fragment Identifier)",
"data": "#a",
"valid": false
},
{
"description": "not a valid JSON-pointer (some escaped, but not all) #1",
"data": "/~0~",
"valid": false
},
{
"description": "not a valid JSON-pointer (some escaped, but not all) #2",
"data": "/~0/~",
"valid": false
},
{
"description": "not a valid JSON-pointer (wrong escape character) #1",
"data": "/~2",
"valid": false
},
{
"description": "not a valid JSON-pointer (wrong escape character) #2",
"data": "/~-1",
"valid": false
},
{
"description": "not a valid JSON-pointer (multiple characters not escaped)",
"data": "/~~",
"valid": false
},
{
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #1",
"data": "a",
"valid": false
},
{
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #2",
"data": "0",
"valid": false
},
{
"description": "not a valid JSON-pointer (isn't empty nor starts with /) #2",
"data": "a/a",
"valid": false
}
]
}
Expand Down