ge main 0.01;
use 5.020;
use experimental 'signatures';
use Getopt::Long;
use Mojo::Template;
use JSON::Pointer;
use YAML::PP;
use OpenAPI::PerlGenerator;
use OpenAPI::PerlGenerator::Utils 'update_fi
B< output > - name of the output directory
=item * B< api > - name of the OpenAPI file (YAML or JSON)
=item * B< tidy > - clean up the code using perltidy
=item * B< compile > - check that the gen
e //= 'openapi/openapi.yaml';
$output_directory //= '.';
my $schema = YAML::PP->new( boolean => 'JSON::PP' )->load_file( $api_file );
my %template = %OpenAPI::PerlGenerator::Template::Mojo::template
$ct =~ s/;\s+.*//;
if( $ct eq '<%= $ct %>' ) {
# we only handle ndjson currently
my $handled_offset = 0;
$resp->on(progress => sub($msg,
lit /\n/, $fresh;
for (@lines) {
my $payload = decode_json( $_ );
$res->push(
% my $type = $info->{content}->{$ct}->{schema};
ct eq 'application/json' ) {
my $payload = $resp->json();
% } elsif( $ct eq 'application/x-ndjson' ) {
# code missing to hack up ndjson into hashes for a
se JSON::Pointer;
use Markdown::Pod;
=head1 NAME
OpenAPI::PerlGenerator - create Perl client SDKs from OpenAPI specs
=head1 SYNOPSIS
my $api_file = slurp( 'petshop.json' );
my $schema = JSON::
ring => 'Str',
number => 'Num',
integer => 'Int',
boolean => '', # a conflict between JSON::PP::Boolean and Type::Tiny
object => 'Object',
);
=item * B<typemap>
Hashref with the map
{ %default_typemap } },
);
sub fixup_json_ref( $root, $curr=$root ) {
if( ref $curr eq 'ARRAY' ) {
for my $c ($curr->@*) {
$c = fixup_json_ref( $root, $c );
}
} e