-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support an RPC structure of API #664
Comments
RPC style APIs could be a side effect of #574. An unfortunate side effect, IMHO. |
@webron it seems like that implementation of operations really solves issue of describing RPC API. There is can be some details related to JSON RPC 2.0, for example, but I hope you cover most cases. |
Parent: #586. |
I use swagger spec to describe JSON-RPC in a hacky way, storing method names in |
@vearutop that sounds interesting—do you have an example you could share? |
|
That's a little disappointing, I was really hoping to see something interesting, like folding of the parameters into the existing document, with clever uses of the flags. Having to use a different library to pull meaningful data is unfortunate. |
Sorry, @wparad, I did not mean to make you sad (mind |
@vearutop, could you clarify, your API has structure according to JSON RPC 2.0 or you are just using RPC style for URL resources? |
@SvyatoslavVasiliev, API is serving valid JSON RPC 2.0 structures. Actually this |
@vearutop, thank you, as I am looking for some tool to specify my JSON RPC API, I will try your approach in swagger. But unfortunately, as @wparad already said, standard swagger library won't be able to work with it fully. For example if I try to upload your specification in on-line swagger editor I won't able to make API requests, because of wrong auto generated URL. |
hi @webron, I was wondering if there's any update on this issue? thanks! |
Hi, same here. I would really be glad to hear that OpenAPI (Swagger) can handle JSON RPC style APIs. |
+1 for this. Swagger is de facto standard. It should feel the urge to influence the standard of RPC documentation as well. |
+1000 Data manipulation and, side by side, function call is a must. By the way json-rpc 2 is pretty simple, good and stable. |
OpenAPI provides JSON Schema to describe a wide range of payloads. If an API provider decides to create a single path item object with many different payloads in order to tunnel procedure calls, then OpenAPI can do that. The support for JSON Schema oneOf in OpenAPI V3 will make that even easier. If people want to build tooling that map those payloads into UI as if they were different path item objects, then they are free to do so. I don't believe that the OpenAPI spec should try and standardize a mapping between those payloads and native HTTP constructs. If there is sufficient community support to standardize that mapping then I would encourage that community to create it and encourage tool builders to support it. |
I have to admit it's a bit harsh to understand all the terms you cite for an outsider for now o: I will follow your tips and wait/contribute example from/to the community. By the way, thanks for the quick answer, and what a good teasing for the v3! |
I ended up using @vearutop 's approach to create a demo. We have a single endpoint for JSON-RPC calls that each have a different method. But I've explained how we resolved it in the main "info" > "description" section of the following OAS3 that I've pushed here: |
I ran into this issue recently too and ended up here from swagger-api/swagger-codegen#4274. I finally have something that is working relatively well for what I am doing so I created a JSON-RPC 2.0 OAS sample gist for anyone else that may benefit from it. You can copy/paste it into http://editor.swagger.io/ to experiment with it. There is a simple POST that includes a JSON-RPC param. I also showed how to use a Copy of gist:
|
@thephez Thanks a lot for your gist, very interesting and helpfull 🥇 . Meanwhile on your example, the 2 calls you described are hitting 2 different urls |
@CharlieBreval Glad it was helpful to you. It's been a while, but as I recall I my reason for the 2 different URLs had something to do with the specific tool that I was importing this into. |
Hi there!
I am realy sad that OpenAPI specification does not support RPC style of API, because of path centric structure. There is so many tools to describe REST API, but there is no such to describe RPC API. And recently your initiative have appeared with Open API ideology, but without supporting of RPC API style. Why? Could you add it to nearest release?
The text was updated successfully, but these errors were encountered: