diff --git a/lib/App/Netdisco/Web.pm b/lib/App/Netdisco/Web.pm index c5c5b187..1588bc06 100644 --- a/lib/App/Netdisco/Web.pm +++ b/lib/App/Netdisco/Web.pm @@ -184,6 +184,12 @@ hook 'before_template' => sub { hook 'after' => sub { my $r = shift; # a Dancer::Response + # workaround for Swagger plugin weird response body + if (request->path eq '/swagger.json') { + $r->content( to_json( $r->content ) ); + header('Content-Type' => 'application/json'); + } + if ($r->content_type and $r->content_type eq 'text/comma-separated-values') { my @newlines = (); my @lines = split m/\n/, $r->content; diff --git a/share/config.yml b/share/config.yml index 168c4d14..be91fc6f 100644 --- a/share/config.yml +++ b/share/config.yml @@ -490,8 +490,7 @@ layout: 'main' plugins: Swagger: main_api_module: 'App::Netdisco' - auto_discover_skip: - - qr#^/(?!api/)\w+# + ui_url: '/swagger-ui' Auth::Extensible: no_api_change_warning: true no_default_pages: true