尚未实现的模拟打开API端点?

发布于 2025-02-03 04:29:48 字数 435 浏览 2 评论 0原文

模拟端点开放的API规范文件定义并不那么困难。

但是,我试图仅模拟 尚未实现的端点。

例如,我有一个OAS文件,该文件定义get /dogs < /code>和get /cats < /code> endpoint。 现在,当我在A中实现get /dogs < /code> - 例如-Nest.js应用程序并且该应用程序正在运行时,我想拥有一个仅模拟get /cats < /cats < /cats的模拟服务器代码>端点。

这样可以将模拟服务器和应用程序捆绑在一起并将它们部署在一起,以便始终返回某种形式的响应(实现或模拟)。

是否有某种具有这种能力的工具/模拟服务器?这样的事情甚至有意义吗?

Mocking endpoints an Open API Specification file defines isn't all that difficult.

However I am trying to mock only the endpoints that don't have an implementation yet.

For example I have an OAS file that defines an GET /dogs and an GET /cats endpoint.
Now when I implement GET /dogs in a - for example - Nest.js application and that application is running, I would want to have a mock server that only mocks the GET /cats endpoint.

That would make it possible to bundle the mock server and the application and to deploy them together, so that some form of response (either the implementation or the mocked) is always returned for every endpoint.

Is there some sort of tool/mock-server that has this kind of ability? Would doing something like that even make sense?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文