jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mojolicious::Lite silently ignores controller configurations due to missing default namespaces

XSven opened this issue · comments

commented
  • Mojolicious version: 9.34
  • Perl version: 5.38.0
  • Operating system: AIX 7.3

Steps to reproduce the behavior

I have used the mojo tool to create a Mojolicious::Lite application. I have enabled the OpenAPI plugin. I have used

$route->to(ucfirst "$op_spec->{operationId}#handle_request");

suggested in the op_spec_to_route experimental feature to configure controller based request dispatching.

Expected behavior

I would like to get a warning that an existing controller configuration is dropped due to missing namespace configuration

<Mojolicious::Lite application> eval -V 'app->routes->namespaces'
[]

Actual behavior

No information about my incomplete setup was provided. As a Mojolicious newbie this was an annoying experience.

I'm not sure what you want. Are you expecting something else than 404 Not Found?

I have properly configured the OpenAPI plugin using the op_spec_to_route attribute and I have used the location suggested by the mojo tool (at the time the Mojolicious::Lite was created) to store the controller. I am missing a warning that tells me that the configuration is incomplete due to

<Mojolicious::Lite application> eval -V 'app->routes->namespaces'
[]

or even better the Controller location suggested by the mojo tool should be a member of the namespaces array.

I don't know how to do that. I will consider a PR though.