Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use Mojolicious::Lite; |
| 3 | use Mojo::ByteStream 'b'; |
| 4 | use Mojo::Date; |
| 5 | use Mojo::JSON qw/true false encode_json decode_json/; |
| 6 | use strict; |
| 7 | use warnings; |
| 8 | use Mojo::JWT; |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 9 | use Mojo::File qw/path/; |
| 10 | use Mojo::Util qw/slugify/; |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 11 | |
| 12 | # This is an API fake server with fixtures |
| 13 | |
| 14 | my $secret = 's3cr3t'; |
Akron | 73f3608 | 2018-10-25 15:34:59 +0200 | [diff] [blame] | 15 | my $fixture_path = path(Mojo::File->new(__FILE__)->dirname)->child('..', 'fixtures'); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 16 | |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 17 | # Legacy: |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 18 | helper jwt_encode => sub { |
| 19 | shift; |
| 20 | return Mojo::JWT->new( |
| 21 | secret => $secret, |
| 22 | token_type => 'api_token', |
| 23 | expires => time + (3 * 34 * 60 * 60), |
| 24 | claims => { @_ } |
| 25 | ); |
| 26 | }; |
| 27 | |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 28 | # Legacy; |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 29 | helper jwt_decode => sub { |
| 30 | my ($c, $auth) = @_; |
| 31 | $auth =~ s/\s*api_token\s+//; |
| 32 | return Mojo::JWT->new(secret => $secret)->decode($auth); |
| 33 | }; |
| 34 | |
| 35 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 36 | # Load fixture responses |
| 37 | helper 'load_response' => sub { |
| 38 | my $c = shift; |
| 39 | my $q_name = shift; |
| 40 | my $file = $fixture_path->child("response_$q_name.json"); |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 41 | $c->app->log->debug("Load response from $file"); |
| 42 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 43 | unless (-f $file) { |
| 44 | return { |
| 45 | status => 500, |
| 46 | json => { |
| 47 | errors => [[0, 'Unable to load query response from ' . $file]] |
| 48 | } |
| 49 | } |
| 50 | }; |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 51 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 52 | my $response = $file->slurp; |
Akron | a3c353c | 2019-02-14 23:50:00 +0100 | [diff] [blame] | 53 | my $decode = decode_json($response); |
| 54 | unless ($decode) { |
| 55 | return { |
| 56 | status => 500, |
| 57 | json => { |
| 58 | errors => [[0, 'Unable to parse JSON']] |
| 59 | } |
| 60 | } |
| 61 | }; |
| 62 | |
| 63 | return $decode; |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 67 | # Base page |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 68 | get '/v1.0/' => sub { |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 69 | shift->render(text => 'Fake server available'); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 70 | }; |
| 71 | |
Akron | 3239663 | 2018-10-11 17:08:37 +0200 | [diff] [blame] | 72 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 73 | # Search fixtures |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 74 | get '/v1.0/search' => sub { |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 75 | my $c = shift; |
| 76 | my $v = $c->validation; |
| 77 | $v->optional('q'); |
| 78 | $v->optional('page'); |
| 79 | $v->optional('ql'); |
Akron | cd42a14 | 2019-07-12 18:55:37 +0200 | [diff] [blame^] | 80 | $v->optional('cq'); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 81 | $v->optional('count'); |
| 82 | $v->optional('context'); |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 83 | $v->optional('offset'); |
| 84 | $v->optional('cutoff')->in(qw/true false/); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 85 | |
Akron | 3239663 | 2018-10-11 17:08:37 +0200 | [diff] [blame] | 86 | $c->app->log->debug('Receive request'); |
| 87 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 88 | # Response q=x&ql=cosmas3 |
| 89 | if ($v->param('ql') && $v->param('ql') eq 'cosmas3') { |
| 90 | return $c->render( |
| 91 | status => 400, |
| 92 | json => { |
| 93 | "\@context" => "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld", |
| 94 | "errors" => [[307,"cosmas3 is not a supported query language!"]] |
| 95 | }); |
| 96 | }; |
| 97 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 98 | if (!$v->param('q')) { |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 99 | return $c->render(%{$c->load_response('query_no_query')}); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 100 | }; |
| 101 | |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 102 | my @slug_base = ($v->param('q')); |
| 103 | push @slug_base, 'o' . $v->param('offset') if defined $v->param('offset'); |
| 104 | push @slug_base, 'c' . $v->param('count') if defined $v->param('count'); |
| 105 | push @slug_base, 'co' . $v->param('cutoff') if defined $v->param('cutoff'); |
Akron | cd42a14 | 2019-07-12 18:55:37 +0200 | [diff] [blame^] | 106 | push @slug_base, 'cq' if defined $v->param('cq'); |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 107 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 108 | # Get response based on query parameter |
Akron | 8ea8429 | 2018-10-24 13:41:52 +0200 | [diff] [blame] | 109 | my $response = $c->load_response('query_' . slugify(join('_', @slug_base))); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 110 | |
| 111 | # Check authentification |
| 112 | if (my $auth = $c->req->headers->header('Authorization')) { |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 113 | |
| 114 | my $jwt; |
| 115 | if ($auth =~ /^Bearer/) { |
| 116 | # Username unknown in OAuth2 |
| 117 | $response->{json}->{meta}->{authorized} = 'yes'; |
| 118 | } |
| 119 | elsif ($jwt = $c->jwt_decode($auth)) { |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 120 | $response->{json}->{meta}->{authorized} = $jwt->{username} if $jwt->{username}; |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 121 | }; |
| 122 | }; |
| 123 | |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 124 | # Set page parameter |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 125 | if ($v->param('page')) { |
Akron | 6d49c1f | 2018-10-11 14:22:21 +0200 | [diff] [blame] | 126 | $response->{json}->{meta}->{startIndex} = $v->param("startIndex"); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 127 | }; |
| 128 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 129 | # Simple search fixture |
Akron | 3239663 | 2018-10-11 17:08:37 +0200 | [diff] [blame] | 130 | $c->render(%$response); |
| 131 | |
| 132 | $c->app->log->debug('Rendered result'); |
| 133 | |
| 134 | return 1; |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 135 | }; |
| 136 | |
Akron | 80a84b2 | 2018-10-24 17:44:24 +0200 | [diff] [blame] | 137 | # Textinfo fixtures |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 138 | get '/v1.0/corpus/:corpusId/:docId/:textId' => sub { |
Akron | 80a84b2 | 2018-10-24 17:44:24 +0200 | [diff] [blame] | 139 | my $c = shift; |
| 140 | |
| 141 | my $file = join('_', ( |
| 142 | 'textinfo', |
| 143 | $c->stash('corpusId'), |
| 144 | $c->stash('docId'), |
| 145 | $c->stash('textId') |
| 146 | )); |
| 147 | |
| 148 | my $slug = slugify($file); |
| 149 | |
| 150 | # Get response based on query parameter |
| 151 | my $response = $c->load_response($slug); |
| 152 | return $c->render(%$response); |
| 153 | }; |
| 154 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 155 | |
Akron | b80341d | 2018-10-15 19:46:23 +0200 | [diff] [blame] | 156 | # Matchinfo fixtures |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 157 | get '/v1.0/corpus/:corpusId/:docId/:textId/:matchId/matchInfo' => sub { |
Akron | b80341d | 2018-10-15 19:46:23 +0200 | [diff] [blame] | 158 | my $c = shift; |
| 159 | |
| 160 | my $file = join('_', ( |
| 161 | 'matchinfo', |
| 162 | $c->stash('corpusId'), |
| 163 | $c->stash('docId'), |
| 164 | $c->stash('textId'), |
| 165 | $c->stash('matchId') |
| 166 | )); |
| 167 | |
Akron | b8d0b40 | 2018-10-18 23:51:52 +0200 | [diff] [blame] | 168 | my $slug = slugify($file); |
| 169 | |
Akron | b80341d | 2018-10-15 19:46:23 +0200 | [diff] [blame] | 170 | # Get response based on query parameter |
Akron | b8d0b40 | 2018-10-18 23:51:52 +0200 | [diff] [blame] | 171 | my $response = $c->load_response($slug); |
Akron | b80341d | 2018-10-15 19:46:23 +0200 | [diff] [blame] | 172 | return $c->render(%$response); |
| 173 | }; |
| 174 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 175 | |
Akron | be61f4c | 2018-10-20 00:52:58 +0200 | [diff] [blame] | 176 | # Statistics endpoint |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 177 | get '/v1.0/statistics' => sub { |
Akron | be61f4c | 2018-10-20 00:52:58 +0200 | [diff] [blame] | 178 | my $c = shift; |
| 179 | my $v = $c->validation; |
| 180 | $v->optional('corpusQuery'); |
| 181 | |
| 182 | my @list = 'corpusinfo'; |
| 183 | if ($v->param('corpusQuery')) { |
| 184 | push @list, $v->param('corpusQuery'); |
| 185 | }; |
| 186 | my $slug = slugify(join('_', @list)); |
| 187 | |
| 188 | # Get response based on query parameter |
| 189 | my $response = $c->load_response($slug); |
| 190 | return $c->render(%$response); |
| 191 | }; |
| 192 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 193 | ############ |
| 194 | # Auth API # |
| 195 | ############ |
| 196 | |
| 197 | # Request API token |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 198 | get '/v1.0/auth/logout' => sub { |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 199 | my $c = shift; |
| 200 | |
| 201 | if (my $auth = $c->req->headers->header('Authorization')) { |
| 202 | if (my $jwt = $c->jwt_decode($auth)) { |
| 203 | my $user = $jwt->{username} if $jwt->{username}; |
| 204 | |
| 205 | $c->app->log->debug('Server-Logout: ' . $user); |
| 206 | return $c->render(json => { msg => [[0, 'Fine!']]}); |
| 207 | }; |
| 208 | }; |
| 209 | |
| 210 | return $c->render(status => 400, json => { error => [[0, 'No!']]}); |
| 211 | }; |
| 212 | |
| 213 | |
| 214 | # Request API token |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 215 | get '/v1.0/auth/apiToken' => sub { |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 216 | my $c = shift; |
| 217 | |
| 218 | # Get auth header |
| 219 | my $auth = $c->req->headers->authorization; |
| 220 | |
| 221 | # Authorization missing or not basic |
| 222 | if (!$auth || $auth !~ s/\s*Basic\s+//gi) { |
| 223 | return $c->render( |
| 224 | json => { |
| 225 | error => [[2, 'x']] |
| 226 | } |
| 227 | ); |
| 228 | }; |
| 229 | |
| 230 | # Decode header |
| 231 | my ($username, $pwd) = @{b($auth)->b64_decode->split(':')->to_array}; |
| 232 | |
| 233 | # the password is 'pass' |
| 234 | if ($pwd) { |
| 235 | |
| 236 | # the password is 'pass' |
| 237 | if ($pwd eq 'pass') { |
| 238 | |
| 239 | # Render info with token |
| 240 | my $jwt = $c->jwt_encode(username => $username); |
| 241 | |
| 242 | # Render in the Kustvakt fashion: |
| 243 | return $c->render( |
| 244 | format => 'html', |
| 245 | text => encode_json({ |
| 246 | %{$jwt->claims}, |
| 247 | expires => $jwt->expires, |
| 248 | token => $jwt->encode, |
| 249 | token_type => 'api_token' |
| 250 | }) |
| 251 | ); |
Akron | 3d67306 | 2019-01-29 15:54:16 +0100 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | elsif ($pwd eq 'ldaperr') { |
| 255 | return $c->render( |
| 256 | format => 'html', |
| 257 | status => 401, |
| 258 | json => { |
| 259 | "errors" => [[2022,"LDAP Authentication failed due to unknown user or password!"]] |
| 260 | } |
| 261 | ); |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 262 | }; |
| 263 | |
| 264 | return $c->render( |
| 265 | json => { |
| 266 | error => [[2004, undef]] |
| 267 | } |
| 268 | ); |
| 269 | }; |
| 270 | |
| 271 | return $c->render( |
| 272 | json => { |
| 273 | error => [[2004, undef]] |
| 274 | } |
| 275 | ); |
| 276 | }; |
| 277 | |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 278 | |
| 279 | # Request API token |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 280 | post '/v1.0/oauth2/token' => sub { |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 281 | my $c = shift; |
| 282 | |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 283 | my $grant_type = $c->param('grant_type') // 'undefined'; |
| 284 | |
| 285 | if ($grant_type eq 'password') { |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 286 | |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 287 | # Check for wrong client id |
| 288 | if ($c->param('client_id') ne '2') { |
| 289 | return $c->render( |
| 290 | json => { |
| 291 | "error_description" => "Unknown client with " . $_->{client_id}, |
| 292 | "error" => "invalid_client" |
| 293 | }, |
| 294 | status => 401 |
| 295 | ); |
| 296 | } |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 297 | |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 298 | # Check for wrong client secret |
| 299 | elsif ($c->param('client_secret') ne 'k414m4r-s3cr3t') { |
| 300 | return $c->render( |
| 301 | json => { |
| 302 | "error_description" => "Invalid client credentials", |
| 303 | "error" => "invalid_client" |
| 304 | }, |
| 305 | status => 401 |
| 306 | ); |
| 307 | } |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 308 | |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 309 | # Check for wrong user name |
| 310 | elsif ($c->param('username') ne 'test') { |
| 311 | return $c->render(json => { |
| 312 | error => [[2004, undef]] |
| 313 | }); |
| 314 | } |
| 315 | |
| 316 | # Check for ldap error |
| 317 | elsif ($c->param('password') eq 'ldaperr') { |
| 318 | return $c->render( |
| 319 | format => 'html', |
| 320 | status => 401, |
| 321 | json => { |
| 322 | "errors" => [ |
| 323 | [ |
| 324 | 2022, |
| 325 | "LDAP Authentication failed due to unknown user or password!" |
| 326 | ] |
| 327 | ] |
| 328 | } |
| 329 | ); |
| 330 | } |
| 331 | |
| 332 | # Check for wrong password |
| 333 | elsif ($c->param('password') ne 'pass') { |
| 334 | return $c->render(json => { |
| 335 | format => 'html', |
| 336 | status => 401, |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 337 | "errors" => [[2022,"LDAP Authentication failed due to unknown user or password!"]] |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 338 | }); |
| 339 | } |
| 340 | |
| 341 | # Return fine access |
| 342 | return $c->render( |
| 343 | json => { |
| 344 | "access_token" => "4dcf8784ccfd26fac9bdb82778fe60e2", |
| 345 | "refresh_token" => "hlWci75xb8atDiq3924NUSvOdtAh7Nlf9z", |
| 346 | "scope" => "all", |
| 347 | "token_type" => "Bearer", |
| 348 | "expires_in" => 86400 |
| 349 | }); |
| 350 | } |
| 351 | |
| 352 | # Refresh token |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 353 | elsif ($grant_type eq 'refresh_token') { |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 354 | return $c->render( |
| 355 | status => 200, |
| 356 | json => { |
| 357 | "access_token" => "abcde", |
| 358 | "refresh_token" => "fghijk", |
| 359 | "token_type" => "Bearer", |
| 360 | "expires_in" => 86400 |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 361 | } |
| 362 | ); |
| 363 | } |
| 364 | |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 365 | # Unknown token grant |
| 366 | else { |
| 367 | return $c->render( |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 368 | status => 400, |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 369 | json => { |
| 370 | "errors" => [ |
| 371 | [ |
Akron | 63d963b | 2019-07-05 15:35:51 +0200 | [diff] [blame] | 372 | 0, "Grant Type unknown", $grant_type |
Akron | 8bbbecf | 2019-07-01 18:57:30 +0200 | [diff] [blame] | 373 | ] |
| 374 | ] |
| 375 | } |
| 376 | ) |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 377 | } |
Akron | 33f5c67 | 2019-06-24 19:40:47 +0200 | [diff] [blame] | 378 | }; |
| 379 | |
| 380 | |
| 381 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 382 | app->start; |
| 383 | |
| 384 | |
| 385 | __END__ |
| 386 | |
| 387 | |
| 388 | # Temporary: |
| 389 | my $collection_query = { |
| 390 | '@type' => "koral:docGroup", |
| 391 | "operation" => "operation:or", |
| 392 | "operands" => [ |
| 393 | { |
| 394 | '@type' => "koral:docGroup", |
| 395 | "operation" => "operation:and", |
| 396 | "operands" => [ |
| 397 | { |
| 398 | '@type' => "koral:doc", |
| 399 | "key" => "title", |
| 400 | "match" => "match:eq", |
| 401 | "value" => "Der Birnbaum", |
| 402 | "type" => "type:string" |
| 403 | }, |
| 404 | { |
| 405 | '@type' => "koral:doc", |
| 406 | "key" => "pubPlace", |
| 407 | "match" => "match:eq", |
| 408 | "value" => "Mannheim", |
| 409 | "type" => "type:string" |
| 410 | }, |
| 411 | { |
| 412 | '@type' => "koral:docGroup", |
| 413 | "operation" => "operation:or", |
| 414 | "operands" => [ |
| 415 | { |
| 416 | '@type' => "koral:doc", |
| 417 | "key" => "subTitle", |
| 418 | "match" => "match:eq", |
| 419 | "value" => "Aufzucht oder Pflege", |
| 420 | "type" => "type:string" |
| 421 | }, |
| 422 | { |
| 423 | '@type' => "koral:doc", |
| 424 | "key" => "subTitle", |
| 425 | "match" => "match:eq", |
| 426 | "value" => "Gedichte", |
| 427 | "type" => "type:string" |
| 428 | } |
| 429 | ] |
| 430 | } |
| 431 | ] |
| 432 | }, |
| 433 | { |
| 434 | '@type' => "koral:doc", |
| 435 | "key" => "pubDate", |
| 436 | "match" => "match:geq", |
| 437 | "value" => "2015-03-05", |
| 438 | "type" => "type:date" |
| 439 | } |
| 440 | ] |
| 441 | }; |