Closed paulusr closed 5 years ago
I have also encountered this issue, with Linux Mint 18.1, perl 5.26. Have installed Mojolicious v8.12. Am trying to install Yancy v1.022.
Am getting an error in the build log as:
# Failed test 'User is not authorized for API spec'
# at t/plugin/auth/basic.t line 119.
# got: '500'
# expected: '401'
Manually running:
prove -b t/plugin/auth/basic.t -v 2>&1 | less
I get:
[2019-02-03 08:58:16.17378] [22116] [error] Not a HASH reference at /home/MYUSER/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/Mojolicious/Plugin/OpenAPI.pm line 282.
which is the line:
if ($op_spec->{responses}{$status} or $op_spec->{responses}{default}) {
And by putting a Dumper($op_spec) above that, it turns out that $op_spec which is returned by line 277:
my $op_spec = $c->openapi->spec || {responses => {$status => {schema => $self->_default_schema}}};
is indeed not a hash, but instead a Mojo::Collection object, containing one item which is the expected hash. I'm not sure why OpenAPI is doing that.
My guess is that's this issue: https://github.com/jhthorsen/mojolicious-plugin-openapi/issues/107
If you install Mojolicious::Plugin::OpenAPI v2.09 manually (cpanm Mojolicious::Plugin::OpenAPI@2.09
) it should work.
That did the trick, thanks!
Confirmed working here also. Cheers.
v1.023 fixes this with an increased dependency on Mojolicious::Plugin::OpenAPI 2.12. Thanks for the report!
Hi,looking forward to trying out Yancy but got the following error:
I would be happy to try debug this myself if you can point me in the right direction. Thanks, Paul