bvanderlaan / swagger-ui-restify

Adds middleware to your restify app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
3 stars 10 forks source link

swagger-ui-restify doesn't work with restify 11 due to missing next #11

Open prachikhadke opened 1 year ago

prachikhadke commented 1 year ago
(node:27895) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/psk/code/swagger-test/node_modules/swagger-ui-restify/package.json' of './lib/index.js'. Please either fix that or report it to the module author
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: Handler [handler-0 on GET /docs] is missing a third argument (the "next" callback) but is not an async function. Middleware handlers can be either async/await or callback-based.Callback-based (non-async) handlers should accept three arguments: (req, res, next). Async handler functions should accept maximum of 2 arguments: (req, res).
    at Chain.add (/Users/psk/code/swagger-test/node_modules/restify/lib/chain.js:79:16)
    at forEach (/Users/psk/code/swagger-test/node_modules/restify/lib/router.js:211:15)
    at Array.forEach (<anonymous>)
    at Router.mount (/Users/psk/code/swagger-test/node_modules/restify/lib/router.js:203:14)
    at Server.serverMethod [as get] (/Users/psk/code/swagger-test/node_modules/restify/lib/server.js:1779:33)
    at module.exports (/Users/psk/code/swagger-test/api/routes/index.js:13:9)
    at Object.<anonymous> (/Users/psk/code/swagger-test/index.js:15:30)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: 'Function',
  expected: 'AsyncFunction',
  operator: '=='
}

Node.js v18.16.0
prachikhadke commented 1 year ago

Found that https://github.com/jamidon/swagger-ui-restify has already created a fix for this but I don't have permissions to open a pr against your repo @bvanderlaan. Can you please create and merge the pr?

seobryn commented 1 week ago

If anyone has the interest I'm Continuing this development over this repo: https://github.com/seobryn/swagger-ui-restify