JSON-RPC Swagger combination

亡梦爱人 提交于 2019-12-01 18:12:35

Coming from the Swagger team, and having little knowledge of JSON-RPC I can provide a partial answer.

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.

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.

A word on the API pattern...

JSON-RPC is incredibly powerful. It is transport agnostic, where as REST is locked to HTTP. If you want to use a stream instead of isolated requests, you would have to hack quite a bit. JSON-RPC changes your paradigm from the onset and running your API over any new transport (socket.io, raw binary, ZeroMQ, fax->OCR, sms, anything) is a trivial implementation.

In my opinion, JSON-RPC is to REST, as REST is to SOAP

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!