add openapi tags to group operations

This commit is contained in:
Oliver Gorwits
2019-01-01 12:34:55 +00:00
parent 2ad803da64
commit c045a96a47
3 changed files with 12 additions and 0 deletions

View File

@@ -77,6 +77,15 @@ my $swagger = Dancer::Plugin::Swagger->instance->doc;
$swagger->{schemes} = ['http','https']; $swagger->{schemes} = ['http','https'];
$swagger->{consumes} = 'application/json'; $swagger->{consumes} = 'application/json';
$swagger->{produces} = 'application/json'; $swagger->{produces} = 'application/json';
$swagger->{tags} = [
{name => 'Global'},
{name => 'Devices',
description => 'Operations relating to Devices (switches, routers, etc)'},
{name => 'Nodes',
description => 'Operations relating to Nodes (end-stations such as printers)'},
{name => 'NodeIPs',
description => 'Operations relating to MAC-IP mappings (IPv4 ARP and IPv6 Neighbors)'},
];
$swagger->{securityDefinitions} = { $swagger->{securityDefinitions} = {
APIKeyHeader => APIKeyHeader =>
{ type => 'apiKey', name => 'Authorization', in => 'header' }, { type => 'apiKey', name => 'Authorization', in => 'header' },

View File

@@ -81,6 +81,7 @@ get qr{^/(?:login(?:/denied)?)?} => sub {
# override default login_handler so we can log access in the database # override default login_handler so we can log access in the database
swagger_path { swagger_path {
description => 'Obtain an API Key using HTTP BasicAuth', description => 'Obtain an API Key using HTTP BasicAuth',
tags => ['Global'],
parameters => [], parameters => [],
responses => { responses => {
default => { default => {
@@ -165,6 +166,7 @@ Dancer::Plugin::Swagger->instance->doc->{paths}->{'/login'}
# we override the default login_handler, so logout has to be handled as well # we override the default login_handler, so logout has to be handled as well
swagger_path { swagger_path {
description => 'Destroy user API Key and session cookie', description => 'Destroy user API Key and session cookie',
tags => ['Global'],
parameters => [], parameters => [],
responses => { default => { examples => { 'application/json' => {} } } }, responses => { default => { examples => { 'application/json' => {} } } },
}, },

View File

@@ -13,6 +13,7 @@ use NetAddr::IP::Lite;
swagger_path { swagger_path {
description => 'Search for a Node to IP mapping (ARP entry)', description => 'Search for a Node to IP mapping (ARP entry)',
tags => ['NodeIPs'],
parameters => [ parameters => [
mac => 'MAC address', mac => 'MAC address',
ip => 'IP address', ip => 'IP address',