JSON-RPC Swagger 组合
我正在考虑使用 这个库 为我的 Web 服务实现 JSON-RPC.我还想为我的服务实现 Swagger.
I am considering to implement JSON-RPC for my web service with this library. I would also like to implement Swagger for my service.
但是,我不确定这两者是否是一个很好的组合.在 JSON-RPC 中,所有方法都位于同一资源后面,而在 Swagger 中则没有任何意义.
However, I am not sure, if these two are a good combination together. In JSON-RPC all methods are behind the same resource, while that does not make any sense in Swagger.
我想知道以下几点:
- 能否将这些技术充分结合起来?
- JSON-RPC 仍然是一种很好的技术吗?还是手动实现更好?
感谢您的想法.
相关的未回答问题:Swagger 和 json-rpc
推荐答案
来自 Swagger 团队,对 JSON-RPC 知之甚少,可以提供部分答案.
Coming from the Swagger team, and having little knowledge of JSON-RPC I can provide a partial answer.
根据您在问题中的描述,绝对不可能使用 Swagger 来记录这样的 API.Swagger 只能记录唯一操作,其中唯一操作定义为路径和 HTTP 动词的组合.
Based on what you described in the question, it would definitely not be possible to use Swagger to document such an API. Swagger can only document unique operations where a unique operation is defined as a combination of path and a HTTP verb.
很遗憾,我无法评论 JSON-RPC 的强大功能,不是因为偏见,而是因为我对它的机制不够了解.此外,Swagger 在描述类似 REST 的 API 时并不打算覆盖 100% 的用例,这并不意味着超出其范围的任何东西都是不好的.
Unfortunately, I cannot comment about the power of JSON-RPC, not because of bias but because I'm not aware enough of its mechanics. To add to that, Swagger does not aim to cover 100% of use cases when describing REST-like APIs, and that does not mean that anything out of its scope is not good.
相关文章