API-CLI
view release on metacpan or search on metacpan
lib/API/CLI/App/Spec.pm view on Meta::CPAN
type => "flag",
summary => "verbose",
aliases => ['v'],
};
$spec->{apppec}->{version} = '0.001';
return $spec;
}
sub param2appspec {
my ($self, $p) = @_;
my $type = $p->{type};
my $required = $p->{required};
my $item = {
name => $p->{name},
type => $type,
required => $required,
summary => $p->{description},
$p->{enum} ? (enum => $p->{enum}) : (),
};
if ($p->{in} eq 'path') {
}
elsif ($p->{in} eq 'query') {
$item->{name} = "q-" . $item->{name};
}
return $item;
}
1;
__END__
=pod
=head1 NAME
API::CLI::App::Spec - Can turn an OpenAPI to App::Spec file
=head1 METHODS
=over 4
=item from_openapi
my $spec = API::CLI::App::Spec->from_openapi(
openapi => $openapi,
name => "myclient",
class => "My::API::CLI", # default API::CLI
);
Returns a L<App::Spec> object from an OpenAPI structure.
=item openapi2appspec
my $hashref = API::CLI::App::Spec->openapi2appspec(
openapi => $openapi,
name => $name,
class => $class,
);
Returns a hashref representing L<App::Spec> data
=item param2appspec
my $appspec_param = $class->param2appspec($p);
Returns a Parameter for L<App::Spec> from an OpenAPI parameter.
=item openapi
Attribute which stores the OpenAPI structure.
=back
=cut
( run in 1.016 second using v1.01-cache-2.11-cpan-39bf76dae61 )