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

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':

use OpenAPI::Generator;

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

But also you can use it directly:

use OpenAPI::Generator::From::Pod;

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

POD FORMAT

Pod format should looks like that:

=head1 NAME

  Controller - some info about this package

=head1 OPENAPI # after this header start openapi block

=over 2 # this is where openapi block starts

=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

=back # this is where openapi block ends

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)