Debian Codegraph @

share/tests/draft6/optional/format/uri-reference.json

raw
1 [
2 {
3 "description": "validation of URI References",
4 "schema": { "format": "uri-reference" },
5 "tests": [
6 {
7 "description": "all string formats ignore integers",
8 "data": 12,
9 "valid": true
10 },
11 {
12 "description": "all string formats ignore floats",
13 "data": 13.7,
14 "valid": true
15 },
16 {
17 "description": "all string formats ignore objects",
18 "data": {},
19 "valid": true
20 },
21 {
22 "description": "all string formats ignore arrays",
23 "data": [],
24 "valid": true
25 },
26 {
27 "description": "all string formats ignore booleans",
28 "data": false,
29 "valid": true
30 },
31 {
32 "description": "all string formats ignore nulls",
33 "data": null,
34 "valid": true
35 },
36 {
37 "description": "a valid URI",
38 "data": "http://foo.bar/?baz=qux#quux",
39 "valid": true
40 },
41 {
42 "description": "a valid protocol-relative URI Reference",
43 "data": "//foo.bar/?baz=qux#quux",
44 "valid": true
45 },
46 {
47 "description": "a valid relative URI Reference",
48 "data": "/abc",
49 "valid": true
50 },
51 {
52 "description": "an invalid URI Reference",
53 "data": "\\\\WINDOWS\\fileshare",
54 "valid": false
55 },
56 {
57 "description": "a valid URI Reference",
58 "data": "abc",
59 "valid": true
60 },
61 {
62 "description": "a valid URI fragment",
63 "data": "#fragment",
64 "valid": true
65 },
66 {
67 "description": "an invalid URI fragment",
68 "data": "#frag\\ment",
69 "valid": false
70 },
71 {
72 "description": "unescaped non US-ASCII characters",
73 "data": "/foobar®.txt",
74 "valid": false
75 },
76 {
77 "description": "invalid backslash character",
78 "data": "https://example.org/foobar\\.txt",
79 "valid": false
80 },
81 {
82 "description": "URI with leading-zero IPv4 is structurally valid as a reg-name",
83 "comment": "RFC 3986, Section 3.2.2: If an IP literal fails strict IPv4address parsing, it falls back to reg-name. A string of digits and dots is valid under unreserved characters. JSON Schema format asserts syntax, not scheme-specific DNS semantics.",
84 "data": "http://087.10.0.1/",
85 "valid": true
86 },
87 {
88 "description": "URI with out-of-bounds IPv4 is structurally valid as a reg-name",
89 "comment": "RFC 3986, Section 3.2.2: Fallback to reg-name allows digits and dots.",
90 "data": "http://999.999.999.999/",
91 "valid": true
92 },
93 {
94 "description": "an empty URI reference",
95 "comment": "RFC 3986, Section 4.2: relative-part includes path-empty, which is zero characters.",
96 "data": "",
97 "valid": true
98 },
99 {
100 "description": "a query-only reference",
101 "comment": "RFC 3986, Section 4.2: relative-ref = relative-part [ \"?\" query ] [ \"#\" fragment ], so a query with an empty path is a reference.",
102 "data": "?query=1",
103 "valid": true
104 },
105 {
106 "description": "a network-path reference with an empty authority",
107 "comment": "RFC 3986, Section 3.2.2: host = IP-literal / IPv4address / reg-name, and reg-name may be empty.",
108 "data": "//",
109 "valid": true
110 },
111 {
112 "description": "an incomplete percent-encoding",
113 "comment": "RFC 3986, Section 2.1: pct-encoded = \"%\" HEXDIG HEXDIG.",
114 "data": "/%zz",
115 "valid": false
116 },
117 {
118 "description": "a double quote in a path",
119 "comment": "RFC 3986, Appendix A: pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\", and the double quote is in none of them.",
120 "data": "/a\"b",
121 "valid": false
122 },
123 {
124 "description": "square brackets outside an authority",
125 "comment": "RFC 3986, Section 3.2.2: square brackets are reserved for an IP-literal inside the authority. path-absolute is built from pchar, which excludes them.",
126 "data": "/[::1]",
127 "valid": false
128 },
129 {
130 "description": "a non-numeric port in a network-path reference",
131 "comment": "RFC 3986, Section 3.2.3: port = *DIGIT. reg-name admits no colon, so the text after the colon can only be a port.",
132 "data": "//example.com:abc/p",
133 "valid": false
134 },
135 {
136 "description": "more than one at-sign in the authority",
137 "comment": "RFC 3986, Section 3.2: authority = [ userinfo \"@\" ] host [ \":\" port ]. Neither userinfo nor host admits a literal at-sign.",
138 "data": "//a@[email protected]/",
139 "valid": false
140 },
141 {
142 "description": "a leading zero in the IPv4 part of an IPv6 literal",
143 "comment": "RFC 3986, Section 3.2.2: inside an IP-literal the dotted quad must be an IPv4address, and dec-octet has no leading-zero alternative. There is no reg-name fallback inside brackets.",
144 "data": "//[::ffff:192.168.0.01]/p",
145 "valid": false
146 },
147 {
148 "description": "a colon in the first segment of a relative-path reference",
149 "comment": "RFC 3986, Section 4.2: relative-part uses path-noscheme, whose first segment is segment-nz-nc - a non-zero-length segment without any colon. A scheme must start with ALPHA, so 1:b cannot be read as a URI either.",
150 "data": "1:b",
151 "valid": false
152 },
153 {
154 "description": "a colon in the first segment preceded by a dot-segment",
155 "comment": "RFC 3986, Section 4.2: \"Such a segment must be preceded by a dot-segment (e.g., \\\"./this:that\\\") to make a relative-path reference.\"",
156 "data": "./this:that",
157 "valid": true
158 },
159 {
160 "description": "a trailing line feed",
161 "comment": "RFC 3986, Appendix A: no production admits %x0A.",
162 "data": "/p\n",
163 "valid": false
164 },
165 {
166 "description": "an uppercase version character in an IPvFuture literal",
167 "comment": "RFC 3986, Section 3.2.2 gives IPvFuture = \"v\" 1*HEXDIG \".\" 1*( unreserved / sub-delims / \":\" ), and RFC 5234, Section 2.3 makes ABNF literals case-insensitive.",
168 "data": "//[V1.fe]/p",
169 "valid": true
170 }
171 ]
172 }
173 ]