-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathextended-tests.json
More file actions
149 lines (147 loc) · 6.28 KB
/
extended-tests.json
File metadata and controls
149 lines (147 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
"Additional Examples 1":{
"level":4,
"variables":{
"id" : "person",
"token" : "12345",
"fields" : ["id", "name", "picture"],
"format" : "json",
"q" : "URI Templates",
"page" : "5",
"lang" : "en",
"geocode" : ["37.76","-122.427"],
"first_name" : "John",
"last.name" : "Doe",
"Some%20Thing" : "foo",
"number" : 6,
"long" : 37.76,
"lat" : -122.427,
"group_id" : "12345",
"query" : "PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?book ?who WHERE { ?book dc:creator ?who }",
"uri" : "http://example.org/?uri=http%3A%2F%2Fexample.org%2F",
"word" : "drücken",
"Stra%C3%9Fe" : "Grüner Weg",
"random" : "šö䟜ñꀣ¥‡ÑÒÓÔÕÖרÙÚàáâãäåæçÿ",
"assoc_special_chars" :
{ "šö䟜ñꀣ¥‡ÑÒÓÔÕ" : "ÖרÙÚàáâãäåæçÿ" }
},
"testcases":[
[ "{/id*}" , "/person" ],
[ "{/id*}{?fields,first_name,last.name,token}","/person?fields=id,name,picture&first_name=John&last.name=Doe&token=12345"],
["/search.{format}{?q,geocode,lang,locale,page,result_type}","/search.json?q=URI%20Templates&geocode=37.76,-122.427&lang=en&page=5"],
["/test{/Some%20Thing}", "/test/foo" ],
["/set{?number}", "/set?number=6"],
["/loc{?long,lat}" , "/loc?long=37.76&lat=-122.427"],
["/base{/group_id,first_name}/pages{/page,lang}{?format,q}","/base/12345/John/pages/5/en?format=json&q=URI%20Templates"],
["/sparql{?query}", "/sparql?query=PREFIX%20dc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%20SELECT%20%3Fbook%20%3Fwho%20WHERE%20%7B%20%3Fbook%20dc%3Acreator%20%3Fwho%20%7D"],
["/go{?uri}", "/go?uri=http%3A%2F%2Fexample.org%2F%3Furi%3Dhttp%253A%252F%252Fexample.org%252F"],
["/service{?word}", "/service?word=dr%C3%BCcken"],
["/lookup{?Stra%C3%9Fe}", "/lookup?Stra%C3%9Fe=Gr%C3%BCner%20Weg"],
["{random}" , "%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"],
["{?assoc_special_chars*}", "?%C5%A1%C3%B6%C3%A4%C5%B8%C5%93%C3%B1%C3%AA%E2%82%AC%C2%A3%C2%A5%E2%80%A1%C3%91%C3%92%C3%93%C3%94%C3%95=%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%BF"]
]
},
"Additional Examples 2":{
"level":4,
"variables":{
"id" : ["person","albums"],
"token" : "12345",
"fields" : ["id", "name", "picture"],
"format" : "atom",
"q" : "URI Templates",
"page" : "10",
"start" : "5",
"lang" : "en",
"geocode" : ["37.76","-122.427"]
},
"testcases":[
[ "{/id*}" , "/person/albums" ],
[ "{/id*}{?fields,token}" , "/person/albums?fields=id,name,picture&token=12345" ]
]
},
"Additional Examples 3: Empty Variables":{
"variables" : {
"empty_list" : [],
"empty_assoc" : {}
},
"testcases":[
[ "{/empty_list}", [ "" ] ],
[ "{/empty_list*}", [ "" ] ],
[ "{?empty_list}", [ ""] ],
[ "{?empty_list*}", [ "" ] ],
[ "{?empty_assoc}", [ "" ] ],
[ "{?empty_assoc*}", [ "" ] ]
]
},
"Additional Examples 4: Numeric Keys":{
"variables" : {
"42" : "The Answer to the Ultimate Question of Life, the Universe, and Everything",
"1337" : ["leet", "as","it", "can","be"],
"german" : {
"11": "elf",
"12": "zwölf"
}
},
"testcases":[
[ "{42}", "The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"],
[ "{?42}", "?42=The%20Answer%20to%20the%20Ultimate%20Question%20of%20Life%2C%20the%20Universe%2C%20and%20Everything"],
[ "{1337}", "leet,as,it,can,be"],
[ "{?1337*}", "?1337=leet&1337=as&1337=it&1337=can&1337=be"],
[ "{?german*}", [ "?11=elf&12=zw%C3%B6lf", "?12=zw%C3%B6lf&11=elf"] ]
]
},
"Additional Examples 5: Explode Combinations":{
"variables" : {
"id" : "admin",
"token" : "12345",
"tab" : "overview",
"keys" : {
"key1": "val1",
"key2": "val2"
}
},
"testcases":[
[ "{?id,token,keys*}", [
"?id=admin&token=12345&key1=val1&key2=val2",
"?id=admin&token=12345&key2=val2&key1=val1"]
],
[ "{/id}{?token,keys*}", [
"/admin?token=12345&key1=val1&key2=val2",
"/admin?token=12345&key2=val2&key1=val1"]
],
[ "{?id,token}{&keys*}", [
"?id=admin&token=12345&key1=val1&key2=val2",
"?id=admin&token=12345&key2=val2&key1=val1"]
],
[ "/user{/id}{?token,tab}{&keys*}", [
"/user/admin?token=12345&tab=overview&key1=val1&key2=val2",
"/user/admin?token=12345&tab=overview&key2=val2&key1=val1"]
]
]
},
"Additional Examples 6: Reserved Expansion":{
"variables" : {
"id" : "admin%2F",
"not_pct" : "%foo",
"list" : ["red%25", "%2Fgreen", "blue "],
"keys" : {
"key1": "val1%2F",
"key2": "val2%2F"
}
},
"testcases": [
["{+id}", "admin%2F"],
["{#id}", "#admin%2F"],
["{id}", "admin%252F"],
["{+not_pct}", "%25foo"],
["{#not_pct}", "#%25foo"],
["{not_pct}", "%25foo"],
["{+list}", "red%25,%2Fgreen,blue%20"],
["{#list}", "#red%25,%2Fgreen,blue%20"],
["{list}", "red%2525,%252Fgreen,blue%20"],
["{+keys}", "key1,val1%2F,key2,val2%2F"],
["{#keys}", "#key1,val1%2F,key2,val2%2F"],
["{keys}", "key1,val1%252F,key2,val2%252F"]
]
}
}