package OpenAPI::Client;
use Mojo::EventEmitter -base;
use Carp ();
use JSON::Validator;
use Mojo::UserAgent;
use Mojo::Promise;
use Scalar::Util qw(blessed);
use constant DEBUG => $ENV{OPENAPI_CLIE
$_[0]") }
sub _generate_class {
my ($parent, $class, $specification, $attrs) = @_;
my $jv = JSON::Validator->new;
$jv->coerce($attrs->{coerce} // 'booleans,numbers,strings');
$jv->store->ua-
sub {
my ($name, $param) = @_;
if (exists $params->{$name}) {
$content{json} = $params->{$name};
}
else {
for ('body', sort keys %{$self->ua->trans
API::Client;
use Mojo::JSON qw(encode_json decode_json j);
use Mojo::Util qw(encode getopt);
use constant YAML => eval 'require YAML::XS;1';
use constant REPLACE => $ENV{JSON_VALIDATOR_REPLACE} //
(json => decode_json $content) : ());
if ($tx->error and $tx->error->{message} eq 'Invalid input') {
_warn _header($tx->req), _header($tx->res) if $verbose;
}
return _json($tx->res->json,
->headers->to_string, "\n\n" }
sub _info {
my ($self, $op) = @_;
local $YAML::XS::Boolean = 'JSON::PP';
unless ($op) {
my $op_spec = $self->_client->validator->bundle->data;
return _sa