kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
892 stars 235 forks source link

[documentation] "Getting started" very unclear on how to do multi-version APIs #807

Open denis-haskin-elemental opened 2 years ago

denis-haskin-elemental commented 2 years ago

https://www.npmjs.com/package/express-openapi#getting-started

The way the example files are named (./api-v1/api-doc.js, ./api-v1/paths/worlds.js, ./api-v1/services/worldsService.js) imply that to add a v2 version of the API, you'd have similar files ./api-v2/api-doc.js, etc).

But the initialization code seems to provide no way to add a v2 version of the API:

initialize({
  app,
  apiDoc: './api-v1/api-doc.yml',
  dependencies: {
    worldsService: v1WorldsService
  },
  paths: './api-v1/paths'
});

I'm trying to figure out how to do this (so far no other examples on the web yet) and once I do, I will submit a PR to update the documentation. Or perhaps someone could write a quick paragraph explaining how it would be done?

jsdevel commented 2 years ago

if you have a good suggestion on how to make the docs clearer please submit a PR!