add more openapi defs

This commit is contained in:
Oliver Gorwits
2018-12-31 22:59:13 +00:00
parent 0866747688
commit 0151fc86a7
2 changed files with 10 additions and 1 deletions

View File

@@ -72,6 +72,15 @@ my $skey = $sessions->find({id => 'dancer_session_cookie_key'});
setting('session_cookie_key' => $skey->get_column('a_session')) if $skey;
Dancer::Session::Cookie::init(session);
# setup for swagger API
my $swagger = Dancer::Plugin::Swagger->instance->doc;
$swagger->{schemes} = ['http','https'];
$swagger->{consumes} = 'application/json';
$swagger->{produces} = 'application/json';
$swagger->{securityDefinitions} = { APIKeyHeader =>
{ type => 'apiKey', name => 'Authorization', in => 'header' } };
$swagger->{security} = [ { APIKeyHeader => [] } ];
# workaround for https://github.com/PerlDancer/Dancer/issues/935
hook after_error_render => sub { setting('layout' => 'main') };