NAME

Mojolicious::Plugin::SwaggerUI - Swagger UI plugin for Mojolicious

SYNOPSIS

# Mojolicious Lite
plugin 'SwaggerUI' => {
    route => app->routes()->any('/swagger'),
    url => '/swagger.json',
};

# Mojolicious Full
$app->plugin(
    SwaggerUI => {
        route   => $app->routes()->any('api'),
        url     => "/api/v1",
        title   => "Mojolicious App",
        favicon => "/images/favicon.png"
    }
);

DESCRIPTION

The plugin allows you to run the Swagger UI component inside your Mojolicious application.

Screenshot

OPTIONS

route

plugin 'SwaggerUI' => { 
    route => app()->routes()->any('/swagger') 
};

Route for the swagger-ui component. It defaults to a any route on /swagger-ui

url

plugin 'SwaggerUI' => {
    url => '/swagger.json'
};

Url for the JSON Swagger specification. It defaults to /v1.

NOTE: Mojolicious::Plugin::OpenAPI can expose the JSON Swagger spec under the base path route. You can just point the path in her and it will automatically work.

title

plugin 'SwaggerUI' => {
    title => 'Project Title'
};

The HTML title that you want to show on swagger-ui page. Deafult to 'Swagger UI'

favicon

plugin 'SwaggerUI' => {
    favicon => '/images/favicon.png'
};

Favicon which you want to associate with swagger-ui page.

It will be served automatically from a 'public' directory if it exists. In case of non existence mojolicious default favicon will be displayed.

AUTHOR

Tudor Marghidanu tudor@marghidanu.com

CREDITS

Gaurav Rai gauravrai7860@gmail.com

COPYRIGHT AND LICENSE

Copyright (C) 2019, Tudor Marghidanu.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.