From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

OpenAPI::Generator::From::Pod - Generate openapi definitions from Perl documentation!

SYNOPSIS

You probably want to use it from OpenAPI::Generator's exported subroutine called 'openapi_from':

my $openapi_def = openapi_from(pod => {src => 'Controller.pm'});

But also you can use it directly:

my $generator = OpenAPI::Generator::From::Pod->new;
my $openapi_def = $generator->generate({src => 'Controllers/'})

POD FORMAT

Pod format should look like that:

Some other pod for your package:

=head1 NAME
Controller - some info about this package

After header 'OPENAPI' and '=over' OpenAPI definition block starts

=head1 OPENAPI
=over 2

List the elements of your OpenAPI definition

=item GET /some/route # define openapi route
parameters:
...
=item SCHEMA User # define openapi components/schemes element
type: object
properites:
...
=item SECURITY Cookie # define security schema
...
=item PARAM userId # define parameter
name: userId
in: query
schema:
type: integer

After this '=back' whole OpenAPI block ends

=back

METHODS

new()

Creates new instance of class

my $generator = OpenAPI::Generator::From::Pod->new
generate($conf)

Using just single Perl module

$generator->generate({src => 'Controller.pm'});

Using directory of Perl modules

$generator->generate({src => 'Controllers'});

OPTIONS

src

File path to module/directory of modules to read pod from

AUTHOR

Anton Fedotov, <tosha.fedotov.2000 at gmail.com>

BUGS

Please report any bugs or feature requests to https://github.com/doojonio/OpenAPI-Generator/issues

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc OpenAPI::Generator

LICENSE AND COPYRIGHT

This software is Copyright (c) 2021 by Anton Fedotov.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)