jhthorsen / mojolicious-plugin-openapi

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

should $c->param('param_name') warn / bail if not spec compliant ? #155

Closed rmallah closed 4 years ago

rmallah commented 4 years ago

once we load the openapi spec via plugin , it will be nice if $c->param('some_param') in controller code raises an alarm if the 'some_param' is not mentioned in the specs.

jhthorsen commented 4 years ago

This is too much work, and the gain is very little from my perspective. Also, what would happen if you do $c->req->url->query->param() instead? I don't see this being doable.

I encourage you to write more unit tests instead. You can't control your user input, but you can control the path of your program.

jhthorsen commented 4 years ago

I'm keeping it open for a bit though, in case new information/reasons arise.

rmallah commented 4 years ago

Thanks for the response, i am posting from the perspective of someone converting existing unorganized APIs to openAPI format. I am loving it(openAPI & this plugin) and trying to post observations.

jhthorsen commented 4 years ago

Thanks for the input! Appreciate it :)