The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Raisin::Plugin::Swagger - Generate API documentation.

SYNOPSIS

    plugin 'Swagger';

DESCRIPTION

Generates a Swagger compatible API documentaion.

Provides a documentation by /swagger.json URL. You can use this url in Swagger UI.

CORS

Enables a cross-origin resource sharing.

    plugin 'Swagger', enable => 'CORS';

VERSION

Supports only version 2.0 of Swagger.

FUNCTIONS

swagger_setup

The function configures base OpenAPI paramters, be aware it is not validating and will be passed as is to OpenAPI client.

Properly configured section has following attributes: title, description, terms_service, contact and license.

Contact has name, url, email.

License has name and url.

See an example below.

    swagger_setup(
        title => 'BatAPI',
        description => 'Simple BatAPI.',

        contact => {
            name => 'Bruce Wayne',
            url => 'http://wayne.enterprises',
            email => 'bruce@batman.com',
        },

        license => {
            name => 'Batman license',
            url => 'http://wayne.enterprises/licenses/',
        },
    );

AUTHOR

Artur Khabibullin - rtkh <at> cpan.org

LICENSE

This module and all the modules in this package are governed by the same license as Perl itself.