Dancer2-Plugin-OpenAPI

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/OpenAPI.pm  view on Meta::CPAN

    },
);

our $FIRST_LOADED = caller(1);

has main_api_module => (
    is => 'ro',
    lazy => 1,
    from_config => 1,
    default => sub { 
        return if $] lt '5.036000';

        $Dancer2::Plugin::OpenAPI::FIRST_LOADED //= caller;
    },
);

has main_api_module_content => (
    is => 'ro',
    lazy => 1,
    default => sub { 
        my $mod = $_[0]->main_api_module or return '';

t/schema-url.t  view on Meta::CPAN

}

my $app = MyApp->to_app;
my $mech = Test::WWW::Mechanize::PSGI->new( app => $app );

my $resp =$mech->get('/openapi.json');
ok $resp->is_success, "/openapi.json exists";

my $body = from_json $resp->content;

if( $] lt '5.036' ) {
    is $body->{info}{version} => '0.0.0';
    ok !$body->{info}{title};
}
else {
    is $body->{info}{version} => '6.1.3';
    is $body->{info}{title} => 'MyApp';
}

done_testing;



( run in 0.590 second using v1.01-cache-2.11-cpan-cc502c75498 )