jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
53 stars 41 forks source link

How to use openapi with mojo's under method for a route #239

Closed jemershaw closed 1 year ago

jemershaw commented 1 year ago

I can't seem to figure out what the ideal way to utilize the under method like you'd use in regular mojo to do pre processing of a request. Is this something that you can do in the openapi spec or do you need to do it with something else?

jhthorsen commented 1 year ago

Since the "paths" section is flat, there's no way to group routes together, but you can add a global under hook. It's documented here: https://metacpan.org/pod/Mojolicious::Plugin::OpenAPI#route1