sub options_route ($c) {
# Generate a route for the OPTIONS method on '/':
# we can't call $openapi->find_path($c->req, my $options = {}); because
# we don't have a specific http method to constrain to...
# so instead we need to write a custom method in OpenAPI::Modern which
# behaves like find_path but finds all matching method+path tuples.
# It should return an array of useful information, where each item consists of
# the $options hash for each matching path (method, path-item, hash of path captures, operation_id, full uri to the path-item object)
# we then construct a response with HTTP 200 and an Allow header listing
# the http methods found, or HTTP 404 if no matches were found.
# for Accept: application/json, we could also include the array of options hashes in the body (maybe translating the property names: s/operation_id/operationId/.
}
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS.
Something like: