seriousme / fastify-openapi-glue

A plugin for the Fastify webserver to autogenerate a Fastify configuration based on a OpenApi(v2/v3) specification.
MIT License
202 stars 34 forks source link

Return route options from operationResolver #483

Closed ivan-tymoshenko closed 1 year ago

ivan-tymoshenko commented 1 year ago

First of all, thanks for your work. Great plugin!

My suggestion is to add a second possible return type for operationResolver to pass a route options object when it's needed.

Example:

{
  operationResolver: (operationId, method, openApiPath) => {
    return {
      logLevel: 'warn',
      version: '1.1.0',
      handler: async (req, res) => {}
    }
  }
}

Tell me if those changes are welcome, I will open a PR.

seriousme commented 1 year ago

Hi,

sounds like a good addition ! Happy to receive a PR :-)

Kind regards, Hans

seriousme commented 1 year ago

Thanks for your contribution! Released as 4.2.0 on NPM.

Kind regards, Hans