express-openapi-validator
express-openapi-validator copied to clipboard
Reading extra properties attached to method in paths a handler function is associated with
I would like to attach arbitrary properties to a method description block that can be read from a handler function. Is that possible right now?
can you provide some additional detail about what you'd like to do. are you proposing new vendor extensions?
Sorry, forget about this, but now:
I am looking at this:
https://swagger.io/docs/specification/openapi-extensions/
Let's say I want to specify some value for a tag or a certain path and I want to use that value in a handler associated with that path or with a route tagged with that tag (I am thinking about a per-method- or per-tag-versioning where I return the version associated with that method in the response header). So no I don't propose new vendor extensions but a generalized mechanism of reading vendor extensions specified in the spec in route handlers.
When I am putting some random vendor extension x-test
on the same level as x-eov-operation-handler
I can see it in request.openapi.schema
:
/service/status:
get:
operationId: getServiceStatus
x-eov-operation-handler: route_handlers/service/status
x-test: test1
Cool!
But for example when I put the prop on an level above that - for example under the path prop
/service/status:
x-test: test1
get:
operationId: getServiceStatus
x-eov-operation-handler: route_handlers/service/status
or under the tag object I apparently don't get it.