jhthorsen / mojolicious-plugin-openapi

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

x-mojo-over feature #85

Closed onokhov closed 6 years ago

onokhov commented 6 years ago

New x-mojo-over key is an ability to create mojolicious routes with conditions passed to Mojolicious::Routes::Route::over

jhthorsen commented 6 years ago

Hey, and thank you for the PR.

I was wondering how this is covered in the OpenAPI spec and/or how this apply to a usecase in the real world.

The diff is so small, that I would like to take it, but without a proper usecase, it’s hard to accept it. Also, it needs a unit test.

onokhov commented 6 years ago

I need x-mojo-over key to use Mojolicious::Plugin::Authorization plugin I can control access to api methods based on user privileges with it. Something like "x-mojo-over": [ "is_role", "admin" ] "x-mojo-over": [ "has_priv", "delete" ]

jhthorsen commented 6 years ago

I that case, I don't think I will take it, since you should rather use https://metacpan.org/pod/Mojolicious::Plugin::OpenAPI::Security

onokhov commented 6 years ago

Thank you. Mojolicious::Plugin::OpenAPI::Security is a correct way

jhthorsen commented 6 years ago

Awesome! Glad that you can use ::Security 👍