ide send_error ?
# TODO: add 'validate_schema'
# TODO: add 'strict_schema'
# TODO: make /swagger.json configurable
package Dancer2::Plugin::OpenAPI;
our $AUTHORITY = 'cpan:YANICK';
# ABSTRACT: creat
/^qr/ ? eval $_ : $_ }
@{ $_[0]->config->{auto_discover_skip} || [
'/openapi.json', ( 'qr!' . $_[0]->ui_url . '!' ) x $_[0]->show_ui
] }
];
},
);
has validate_res
url configurable
$self->app->add_route(
method => 'get',
regexp => '/openapi.json',
code => sub { $self->doc },
);
if ( $self->show_ui ) {
my $base_url =
_ro';
use Carp;
use Hash::Merge;
use Clone 'clone';
use List::AllUtils qw/ first any none /;
use JSON;
use Class::Load qw/ load_class /;
has route => ( handles => [ 'pattern' ] );
has tags => ( pre
", ref $serializer
if none { $serializer->isa($_) } qw/ Dancer2::Serializer::JSON Dancer2::Serializer::YAML /;
$r->{examples}{$serializer->content_type} = $example
definitions},
properties => { response => $schema },
};
my $result = load_class('JSON::Schema::AsType')->new( schema => $schema)->validate_explain({ response => $data });
return