OpenAPI is not similar to gRPC because it's noun-oriented, not verb-oriented. gRPC is more like SOAP: ignore HTTP semantics and write method calls and we'll sort it out. OpenAPI is somewhere on the path to full REST: few verbs; lots of nouns.
Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
191–200 of 286 posts
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#192Unless you are doing bidirectional streaming (for which it seems pretty well suited, but I haven't used it, so it might be a fucking mess), grpc is usually a waste of time. Runtime transitive dependency hell, toolchain hell, and the teams inside Google that manage various implementations philosophically disagree on how basic features should work. Try exposing a grpc api to a team that doesn't use your language (parti…
In my opinion, you shouldn't expose it to a browser, it's not what is good at, build something custom that converts to json. Like using REST to talk between backend services, makes no sense using a human readable protocol/api especially if there are performance requirements (not a call every now and then with a small amount of data returned).
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#193Earlier quoted context omitted.
What do you mean by “leak verbs”?
Not OP, but https://cloud.google.com/blog/products/api-management/restfu... The problem is that clients generally have a bunch of verbs they need to do. You have to design your objects and permissions just right such that clients can do all their verbs without an attacker being able to PATCH "payment_status" from "Requires Payment" to "Payment Confirmed". RPC uses verbs, so that could just be the SubmitPayment RPC's…
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#194I've been building API's for a long time, using gRPC, and HTTP/REST (we'll not go into CORBA or DCOM, because I'll cry). To that end, I've open sourced a Go library for generating your clients and servers from OpenAPI specs ( https://github.com/oapi-codegen/oapi-codegen ). I disagree with the way this article breaks down the options. There is no difference between OpenAPI and REST, it's a strange distinction. OpenAPI…
> There is no difference between OpenAPI and REST, it's a strange distinction. That threw me off too. What the article calls REST, I understand to be closer to HATEOAS. > I've open sourced a Go library for generating your clients and servers from OpenAPI specs As a maintainer of a couple pretty substantial APIs with internal and external clients, I'm really struggling to understand the workflow that starts with gener…
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#195Earlier quoted context omitted.
> This is why I created an abomination that uses go/ast and friends to generate the OpenAPI spec from the code. This is against "interface first" principle and couples clients of your API to its implementation. That might be OK if the only consumer of the API is your own application as in that case API is really just an internal implementation detail. But even then - once you have to support multiple versions of your…
I don't see why it couples clients to the implementation. Effectively, there's no difference between writing the code first and updating the OpenAPI spec, and updating the spec first and then doing some sort of code gen to update the implementation. The end state of the world is the same. In either case, modifications to the spec will be scrutinized to make sure there are no breaking changes.
That is, generate spec from code and your spec is limited to what can be expressed by the code, its annotations, and the support that the generator has. Most generators (to or from openapi) are imperfect and have to compromise on some features, which can lead to miscommunication between clients/servers.
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#196Earlier quoted context omitted.
Since you mention Maven I'm going to make the assumption that you are using Java. I haven't used Java in quite a while. The last 8 years or so I've been programming Go. Your experience of gRPC seems to be very different from mine. How much of the difference in experience do you think might be down to Java and how much is down to gRPC as a technology?
It's not Java itself, it's design decisions on the tooling that Google provides for Java, mostly the protobuf-gen plugin. At my company we found some workarounds to the issues brought up on GP but it's annoying the tooling is a bit subpar.
a couple of links
https://buf.build/protocolbuffers/java?version=v29.3 https://buf.build/docs/bsr/generated-sdks/maven
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#197As someone who has worked at a few of the FAANGs, having thrift/grpc is a godsend for internal service routing, but a lot of the complexity is managed by teams building the libraries, creating the service discovery layers, doing the routing etc. But using an RPC protocol enables those things to happen on a much greater scale and speed than you could ever do with your typical JSON/REST service. I've also never seen a…
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#198I've been building API's for a long time, using gRPC, and HTTP/REST (we'll not go into CORBA or DCOM, because I'll cry). To that end, I've open sourced a Go library for generating your clients and servers from OpenAPI specs ( https://github.com/oapi-codegen/oapi-codegen ). I disagree with the way this article breaks down the options. There is no difference between OpenAPI and REST, it's a strange distinction. OpenAPI…
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#199This article is more of a marketing / paid endorsement for"gRPC" than something that is speaking any truth. The article mentions that "the least used" API method is REST, and I would argue, as would almost any developer (except google employees) would argue that gRPC is the least used and REST is by far the most widely adopted method.
There is no way it is the most widely adopted method. To ever get to see a REST service in the wild is like winning the lottery.
Re: Understanding gRPC, OpenAPI and REST and when to use them in API design (2020)
#200Isn't that WHY you go to investors? To get the funding to hire to get it to market?