pmcelhaney / counterfact

OpenAPI / Swagger to TypeScript generator and mock server
MIT License
80 stars 11 forks source link

Multiple APIs #853

Open pmcelhaney opened 1 month ago

pmcelhaney commented 1 month ago

We have multiple internal/external services that we are mocking. It would be great to run the server over multiple generated clients (with different base URLs)

Originally posted by @kaikun213 in https://github.com/pmcelhaney/counterfact/issues/823#issuecomment-2051497679

pmcelhaney commented 1 month ago

How would we specify multiple APIs? I'm thinking something like an OpenAPI-collection.yaml file that has a list of references to OpenAPI files and (optionally) the paths to which they map. We would pass that to the CLI in place of the OpenAPI spec. I wonder if there's already an open standard for that.

dethell commented 1 month ago

I poked around the OpenApi documentation and couldn't see anything for 2.0 or 3.0 that provided a mechanism for a collection of OpenAPI schemas.

Can we just have multiple instances using succeeding filenames/urls?:

npx counterfact@latest my-first-schema.json path1 my-second-schema.yml path2 ...