|
28 | 28 | "testcases":[ |
29 | 29 |
|
30 | 30 | [ "{/id*}" , "/person" ], |
31 | | - [ "{/id*}{?fields,first_name,last.name,token}" , [ |
32 | | - "/person?fields=id,name,picture&first_name=John&last.name=Doe&token=12345", |
33 | | - "/person?fields=id,picture,name&first_name=John&last.name=Doe&token=12345", |
34 | | - "/person?fields=picture,name,id&first_name=John&last.name=Doe&token=12345", |
35 | | - "/person?fields=picture,id,name&first_name=John&last.name=Doe&token=12345", |
36 | | - "/person?fields=name,picture,id&first_name=John&last.name=Doe&token=12345", |
37 | | - "/person?fields=name,id,picture&first_name=John&last.name=Doe&token=12345"] |
38 | | - ], |
39 | | - ["/search.{format}{?q,geocode,lang,locale,page,result_type}", |
40 | | - [ "/search.json?q=URI%20Templates&geocode=37.76,-122.427&lang=en&page=5", |
41 | | - "/search.json?q=URI%20Templates&geocode=-122.427,37.76&lang=en&page=5"] |
42 | | - ], |
| 31 | + [ "{/id*}{?fields,first_name,last.name,token}","/person?fields=id,name,picture&first_name=John&last.name=Doe&token=12345"], |
| 32 | + ["/search.{format}{?q,geocode,lang,locale,page,result_type}","/search.json?q=URI%20Templates&geocode=37.76,-122.427&lang=en&page=5"], |
43 | 33 | ["/test{/Some%20Thing}", "/test/foo" ], |
44 | 34 | ["/set{?number}", "/set?number=6"], |
45 | 35 | ["/loc{?long,lat}" , "/loc?long=37.76&lat=-122.427"], |
|
67 | 57 | }, |
68 | 58 | "testcases":[ |
69 | 59 |
|
70 | | - [ "{/id*}" , ["/person/albums","/albums/person"] ], |
71 | | - [ "{/id*}{?fields,token}" , [ |
72 | | - "/person/albums?fields=id,name,picture&token=12345", |
73 | | - "/person/albums?fields=id,picture,name&token=12345", |
74 | | - "/person/albums?fields=picture,name,id&token=12345", |
75 | | - "/person/albums?fields=picture,id,name&token=12345", |
76 | | - "/person/albums?fields=name,picture,id&token=12345", |
77 | | - "/person/albums?fields=name,id,picture&token=12345", |
78 | | - "/albums/person?fields=id,name,picture&token=12345", |
79 | | - "/albums/person?fields=id,picture,name&token=12345", |
80 | | - "/albums/person?fields=picture,name,id&token=12345", |
81 | | - "/albums/person?fields=picture,id,name&token=12345", |
82 | | - "/albums/person?fields=name,picture,id&token=12345", |
83 | | - "/albums/person?fields=name,id,picture&token=12345"] |
84 | | - ] |
| 60 | + [ "{/id*}" , "/person/albums" ], |
| 61 | + [ "{/id*}{?fields,token}" , "/person/albums?fields=id,name,picture&token=12345" ] |
85 | 62 | ] |
86 | 63 | }, |
87 | 64 | "Additional Examples 3: Empty Variables":{ |
|
114 | 91 | [ "{?1337*}", "?1337=leet&1337=as&1337=it&1337=can&1337=be"], |
115 | 92 | [ "{?german*}", [ "?11=elf&12=zw%C3%B6lf", "?12=zw%C3%B6lf&11=elf"] ] |
116 | 93 | ] |
| 94 | + }, |
| 95 | + "Additional Examples 5: Explode Combinations":{ |
| 96 | + "variables" : { |
| 97 | + "id" : "admin", |
| 98 | + "token" : "12345", |
| 99 | + "tab" : "overview", |
| 100 | + "keys" : { |
| 101 | + "key1": "val1", |
| 102 | + "key2": "val2" |
| 103 | + } |
| 104 | + }, |
| 105 | + "testcases":[ |
| 106 | + [ "{?id,token,keys*}", [ |
| 107 | + "?id=admin&token=12345&key1=val1&key2=val2", |
| 108 | + "?id=admin&token=12345&key2=val2&key1=val1"] |
| 109 | + ], |
| 110 | + [ "{/id}{?token,keys*}", [ |
| 111 | + "/admin?token=12345&key1=val1&key2=val2", |
| 112 | + "/admin?token=12345&key2=val2&key1=val1"] |
| 113 | + ], |
| 114 | + [ "{?id,token}{&keys*}", [ |
| 115 | + "?id=admin&token=12345&key1=val1&key2=val2", |
| 116 | + "?id=admin&token=12345&key2=val2&key1=val1"] |
| 117 | + ], |
| 118 | + [ "/user{/id}{?token,tab}{&keys*}", [ |
| 119 | + "/user/admin?token=12345&tab=overview&key1=val1&key2=val2", |
| 120 | + "/user/admin?token=12345&tab=overview&key2=val2&key1=val1"] |
| 121 | + ] |
| 122 | + ] |
| 123 | + }, |
| 124 | + "Additional Examples 6: Reserved Expansion":{ |
| 125 | + "variables" : { |
| 126 | + "id" : "admin%2F", |
| 127 | + "not_pct" : "%foo", |
| 128 | + "list" : ["red%25", "%2Fgreen", "blue "], |
| 129 | + "keys" : { |
| 130 | + "key1": "val1%2F", |
| 131 | + "key2": "val2%2F" |
| 132 | + } |
| 133 | + }, |
| 134 | + "testcases": [ |
| 135 | + ["{+id}", "admin%2F"], |
| 136 | + ["{#id}", "#admin%2F"], |
| 137 | + ["{id}", "admin%252F"], |
| 138 | + ["{+not_pct}", "%25foo"], |
| 139 | + ["{#not_pct}", "#%25foo"], |
| 140 | + ["{not_pct}", "%25foo"], |
| 141 | + ["{+list}", "red%25,%2Fgreen,blue%20"], |
| 142 | + ["{#list}", "#red%25,%2Fgreen,blue%20"], |
| 143 | + ["{list}", "red%2525,%252Fgreen,blue%20"], |
| 144 | + ["{+keys}", "key1,val1%2F,key2,val2%2F"], |
| 145 | + ["{#keys}", "#key1,val1%2F,key2,val2%2F"], |
| 146 | + ["{keys}", "key1,val1%252F,key2,val2%252F"] |
| 147 | + ] |
117 | 148 | } |
118 | 149 | } |
0 commit comments