jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 42 forks source link

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

Closed KalessinD closed 4 years ago

KalessinD commented 4 years ago

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 { _helpervalidate($[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 commented 4 years ago

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 commented 4 years ago

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