Polka: OpenAPI Integration

Created on 26 Mar 2020  路  3Comments  路  Source: lukeed/polka

Is it possible to have a swagger plugin for polka? Or maybe an alternative...

future

Most helpful comment

Yes, there will be an OpenAPI integration, but not as part of 1.0.

I can't tell if it makes sense as a plugin or if it should be a larger framework that builds upon Polka. I'm leaning towards the latter because in order for OpenAPI to make sense (and work) it has to be strictly implemented.

All 3 comments

Yes, there will be an OpenAPI integration, but not as part of 1.0.

I can't tell if it makes sense as a plugin or if it should be a larger framework that builds upon Polka. I'm leaning towards the latter because in order for OpenAPI to make sense (and work) it has to be strictly implemented.

A first step could be getting a "plugin" (PR) for https://github.com/PayU/openapi-validator-middleware, which already supports express, koa, and fastify. It looks like we're missing req.baseUrl and req.route.path that it relies on from express, whenever I try to just import it and use it in express-mode.

Something like this to make it compatible:

function reqEnhancer(req, res, next) {
  req.baseUrl = "";
  req.route = {
    path: req.path,
  };
  next();
}

(I have that library working with this setup)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ASaiAnudeep picture ASaiAnudeep  路  4Comments

alekbarszczewski picture alekbarszczewski  路  3Comments

deadcoder0904 picture deadcoder0904  路  8Comments

benderTheCrime picture benderTheCrime  路  11Comments

lagmanzaza picture lagmanzaza  路  4Comments