diff --git a/lib/Game/EvonyTKR/Web.pm b/lib/Game/EvonyTKR/Web.pm index 190a00a..53bfeb0 100644 --- a/lib/Game/EvonyTKR/Web.pm +++ b/lib/Game/EvonyTKR/Web.pm @@ -73,7 +73,7 @@ package Game::EvonyTKR::Web { $self->plugin('DefaultHelpers'); my $OpenAPISchemaFilename = File::Spec->catfile($dist_dir, "openapi.schema.yaml"); - my $OpenAPISchema = get_openapi($OpenAPISchemaFilename); + #my $OpenAPISchema = get_openapi($OpenAPISchemaFilename); $self->config({ openapi => { document_filename => $OpenAPISchemaFilename, @@ -81,7 +81,7 @@ package Game::EvonyTKR::Web { } }); - $self->plugin('OpenAPI::Modern', $self->config->{openapi}); + #$self->plugin('OpenAPI::Modern', $self->config->{openapi}); $self->plugin('Game::EvonyTKR::Web::Routes::Generals', $r); # Normal route to controller diff --git a/lib/Game/EvonyTKR/Web/Routes/Generals.pm b/lib/Game/EvonyTKR/Web/Routes/Generals.pm index 2ab47a9..1bc6926 100644 --- a/lib/Game/EvonyTKR/Web/Routes/Generals.pm +++ b/lib/Game/EvonyTKR/Web/Routes/Generals.pm @@ -26,14 +26,15 @@ package Game::EvonyTKR::Web::Routes::Generals { ); my $namedID = $generalRoutes->under('/named/' => sub ($c) { - $c->log()->trace(`in generalRoutes namedID under clause`); - my $result = $c->openapi->validate_request($c->req); + $logger->trace('in generalRoutes namedID under clause'); + my $result = true; #$c->openapi->validate_request($c->req); if(!$result) { - $c->log()->warn('invalid request recieved',); + $logger->warn('invalid request recieved',); $c->respond_to( any => { data => 'Invalid Request', status => 404 } ); } + return 1; }); $namedID->get('/:name' => [format => ['html','txt', 'json']])->to( diff --git a/script/oapitest.pl b/script/oapitest.pl index a37398d..041e930 100755 --- a/script/oapitest.pl +++ b/script/oapitest.pl @@ -5,6 +5,7 @@ use YAML::XS qw{ LoadFile Load }; use OpenAPI::Modern; use File::Share qw(dist_dir dist_file); +use Data::Printer; my $OpenAPISchemaCache; my $dist_dir = dist_dir('Game-EvonyTKR'); @@ -22,9 +23,12 @@ ($openapi_filename) my $openapi_file = Path::Tiny::path($openapi_filename); my $openapi; if ($newTemp or $serialized_file->stat->mtime < $openapi_file->stat->mtime) { + my $loadedFile = LoadFile($openapi_file); + say Data::Printer::p($loadedFile); + $openapi = OpenAPI::Modern->new( openapi_uri => '/', - openapi_schema => Load($openapi_file->slurp_raw), # your openapi document + openapi_schema => $loadedFile, # your openapi document ); my $frozen = Sereal::Encoder->new({ freeze_callbacks => 1 })->encode($openapi); $serialized_file->spew_raw($frozen);