I have been trying to wrap my head around mock api services, such as the one that Stoplight provides. I want to create something similar, but I keep hitting a wall and I can't imagine why it should be so hard to figure out. Here's the details.
Stoplight has a feature where each project has its own mock api server. The mock server works out of the Open API spec (OAS) specifically for that project. This means that every time someone creates a new project, a new mock server is also created. I assume this happens automatically behind the scenes through some scripting, unless it's a truly dynamic process. Stoplight has an open source mock server project called Prism, and I can only assume thats is what is used as the tool for the mock servers.
When you run Prism, you must give it a url for the OAS. That means that one instance of the server can handle one OAS. Based on this info, Stoplight would need to spin up a Docker instance for each new project. That would end up with a lot of containers, most of them probably never used. Thats doesn't seem like a very good solution, so they must do something else.
Prism also has the ability to serve multiple OAS through something they call reverse proxy. This means that you can use one base URL to server many different OAS. However, behind the scenes, Prism is still running one container for each OAS. This is the most likely situation so far, but I can't figure out how new mock servers are created in a dynamic fashion.
Does anyone have any input on how to achieve such a scenario? Is one Docker container per OAS really the way to go? And if so, what would I need to do to start, stop and reload containers from my backend?