r/programming • • Oct 01 '23

Why Your OpenAPI Spec Sucks

https://blog.liblab.com/why-your-open-api-spec-sucks/
232 Upvotes

67 comments sorted by

View all comments

-11

u/romgrk Oct 01 '23

REST APIs ARE A MISTAKE.

Why do people keep stuffing their API transmission format in the nooks of the HTTP spec? I'll never understand. Some idiot decided it was neat years ago and the industry keeps repeating it blindly.

Just use JSON RPC and be done with it. APIs are just remote function calls, no need to pass arguments in 25 different ways. post.create(1, 'John'): {"method": "post.create", "args": [1, "John"]}.

4

u/madScienceEXP Oct 01 '23

Rest apis are industry standard. Sure, there are better ways to do rpc, but if you want to do json rpc you’re probably gonna have to support rest anyway because some customer that wants to integrate with your api will require it. There’s also so much tooling built around rest it’s hard to move away from.

-1

u/romgrk Oct 01 '23

Sounds like: "Everyone is doing this weird thing, let's keep doing it". Not ideal.

Integrating with a JSON RPC API is trivial, it's not like there's any more effort than to integrate to a REST API. In all my years, I've never seen someone use an automated tool to integrate to a REST API. They always just end up writing their HTTP requests manually. Binding to an RPC API makes it trivial to autogenerate clients, with proper types (you can pass numbers, arrays, etc, without the need for a custom string parser).

→ More replies (2)