express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

Reading extra properties attached to method in paths a handler function is associated with

Open joerg-walter-de opened this issue 4 years ago • 3 comments

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?

joerg-walter-de avatar May 04 '20 21:05 joerg-walter-de

can you provide some additional detail about what you'd like to do. are you proposing new vendor extensions?

cdimascio avatar May 06 '20 13:05 cdimascio

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.

joerg-walter-de avatar Nov 24 '22 13:11 joerg-walter-de

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.

joerg-walter-de avatar Nov 24 '22 14:11 joerg-walter-de