Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$args variable is missed in the definition of "openapi.valid_input" #187

Closed
KalessinD opened this issue Aug 6, 2020 · 2 comments
Closed
Assignees
Labels

Comments

@KalessinD
Copy link

KalessinD commented Aug 6, 2020

There exists the defenition of "openapi.valid_input" helper in Mojolicious::Plugin::OpenAPI package.
This defenition looks like the below one:

$app->helper('openapi.valid_input' => sub { helper_validate($[0]) ? undef : $[0] });

I suppose that the $_[1] argument was omitted in the call of "_helper_validate" method.
This omission makes impossible to pass "$args" variable into this method.

I presume that the proper version of this line should look as follows:

$app->helper('openapi.valid_input' => sub { _helper_validate($[0], $[1]) ? undef : $[0] });

Please fix it, if you are agree.

Thanks in advance.

@jhthorsen jhthorsen self-assigned this Aug 6, 2020
@jhthorsen
Copy link
Owner

Why do you want to pass arguments into $c->openapi->valid_input()? I think maybe the documentation is wrong, and also how $c->openapi->validate works. I'm guessing you want $c->openapi->validate, but without the need to pass in {auto_render => 0} ?

@jhthorsen
Copy link
Owner

I've fixed the code now, so $c->openapi->validate actully behaves as documented. Going to make a new release soon.

jhthorsen pushed a commit that referenced this issue Aug 11, 2020
 - Add support for v3 object parameters #184
   Contributor: SebMourlhou
 - Add support for passing in custom spec to $c->openapi->render_spec #189
 - Fix handling 404 and 501 in v3 #179
 - Fix issue when "nullable" is stored inside JSON::Validator::Ref #183
 - Fix $c->openapi->validate helper #187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants