OpenAPI-Specification
grpc-web
OpenAPI-Specification | grpc-web | |
---|---|---|
47 | 35 | |
29,104 | 8,680 | |
0.5% | 0.6% | |
9.8 | 6.8 | |
7 days ago | 2 months ago | |
Markdown | JavaScript | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
OpenAPI-Specification
- OpenAPI 3.1.1 Specification
-
Log Streaming - what we got wrong and how we fixed it
gRPC A little more background on how our control-plane used to work: we had an HTTP-based API gateway that talked to our gRPC monolithic backend service.6 We thought about extending gRPC streaming from our backend to clients…but the API-gateway handled auth and connections for us and doing gRPC in our Javascript frontend wasn’t something we wanted to take on and in addition it meant that we wouldn’t be able to curl our endpoints easily. To me there’s nothing quite like curl localhost:8000 to begin understanding a service.7 Websockets Websockets would have been fun, but truthfully we didn’t need ‘em, the communication we wanted was really just getting output to our users quickly and we didn’t really need bi-directional communication. Server-Sent Events Server Sent Events (SSE) is pretty cool, enabling sending real-time updates to clients. SSE is well-supported by browsers and you can also “just curl it!”. One of the only drawbacks for us was the OpenAPI support wasn’t great at the time (see this), but our frontend team was able to work around it and in addition there wasn’t a tightly defined model for the logs output, so the benefits of using our spec (strict types) weren’t as big here compared to other parts of our API.
-
Understanding FastAPI: How OpenAPI works
If we go to the OpenAPI's repository, we'll see that:
-
Writing type safe API clients in TypeScript
And I'll be using the OpenAPI Pet Store spec file as an example.
-
Show HN: OpenAPI DevTools – Chrome ext. that generates an API spec as you browse
I saw your sibling comment about "keeping it simple," however that is a bit counter to "generates OpenAPI specifications" since those for sure are not limited to just application/json request/response bodies
I wanted to draw your attention to "normal" POST application/x-www-form-urlencoded <https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/vers...> and its multipart/form-data friend <https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/vers...>
The latter is likely problematic, but the former is in wide use still, including, strangely enough, the AWS API, although some of their newer services do have an application/json protocol
I know that's a lot of words, but the tl;dr would be that if you want your extension to be application/json only, then changing the description to say "OpenAPI specifications for application/json handshakes" would help the consumer be on the same page with your goals
-
How to Connect a FastAPI Server to PostgreSQL and Deploy on GCP Cloud Run
Since FastAPI is based on OpenAPI, at this point you can also use the automatically generated docs. There are multiple options, and two are included by default. Try them out by accessing the following URLs:
-
Write a scalable OpenAPI specification for a Node.js API
This approach requires a constant context switch and is clearly not productive. Here, the OpenAPI Specification can help; you might already have it, but is it scalable? In this article, we’ll learn how to create an OpenAPI Specification document that is readable, scalable, and follows the principle of extension without modifying the existing document.
-
OpenAPI 3.1 - The Gnarly Bits
Phil Sturgeon, who along with Ben Hutton and Henry Andrews from the JSON Schema community, helped drive the push to full JSON Schema Draft 2020-12 compliance, has written a blog post for the official OpenAPIs.org website on how to transition your OAS documents from v3.0.x to v3.1.0.
-
Documenting Node.js API using Swagger
In this article, we will be learning how to document API written in Node.js using a tool called Swagger. Swagger allows you to describe the structure of your APIs so that machines can read them. The ability of APIs to describe their own structure is the root of all awesomeness in Swagger. Why is it so great? Well, by reading our API’s structure, swagger can automatically build beautiful and interactive API documentation. It can also automatically generate client libraries for your API in many languages and explore other possibilities like automated testing. Swagger does this by asking our API to return a YAML or JSON that contains a detailed description of your entire API. This file is essentially a resource listing of our API which adheres to OpenAPI Specifications.
-
Getting started with REST APIs
You may encounter APIs described as RESTful that do not meet these criteria. This is often the result of bottom-up coding, where top-down design should have been used. Another thing to watch out for is the absence of a schema. There are alternatives, but OpenAPI is a common choice with good tools support. If you don't have a schema, you can create one by building a Postman collection.
grpc-web
-
gRPC: 5 Years Later, Is It Still Worth It?
It drives me bonkers that HTTP packs so many awesome capabilities that enable so much awesome gRPC stuff.
Then web browsers never implement any of those capabilities.
gRPC-web's roadmap is still a huge pile of workarounds they intend to build. These shouldn't be necessary! https://github.com/grpc/grpc-web/blob/master/doc/roadmap.md
Instead of giving us http-push, everyone said, oh, we haven't figured out how to use it for content delivery well. And we've never ever let anyone else use it for anything. So to got canned.
Http-trailers also seems to not have support, afaik.
Why the web pours so much into HTML, js, CSS, but utterly neglects http, to the degree where grpc-web will probably end up tunneling http-over-webtransport is so cursed.
-
Browser Client to gRPC Server Routing options: Connect, gRPC-web, gRPC-gateway and more!
Connect also offers direct support for the gRPC-Web protocol used by grpc/grpc-web, without relying on a translating proxy like Envoy.
-
Ask HN: WebSocket server transforming channel subscriptions to gRPC streams
* Additionally, client can stream data to the backend server (if bidirectional GRPC streams are used). I.e. client sends WebSocket messages, those will be transformed to GRPC messages by WebSocket server and delivered to the application backend.
As a result we have a system which allows to quickly create individual streams by using strict GRPC contract but terminating connections over WebSocket transport. So it works well in web browsers. After that no need to write WebSocket protocol, client implementation, handle WebSocket connection. This all will be solved by a suggested WebSocket server and its client SDKs.
The mechanics is similar to Websocketd (https://github.com/joewalnes/websocketd), but instead of creating OS processes we create GRPC streams. The difference from grpc-web (https://github.com/grpc/grpc-web) is that we provide streaming capabilities but not exposing GRPC contract to the client - just allowing to stream any data as payload (both binary and text) with some wrappers from our client SDKs side for managing subscriptions. I.e. it's not native GRPC streams on the client side - we expose just Connection/Subscription object to stream in both directions. GRPC streams used only for communication between WebSocket server and backend. To mention - grpc-web does not support all kinds of streaming now (https://github.com/grpc/grpc-web#streaming-support) while proposed solution can. This all should provide a cross-platform way to quickly write streaming apps due to client SDKs and language-agnostic nature of GRPC.
I personally see both pros and cons in this scheme (without concentrating on both too much here to keep the question short). I spent some time thinking about this myself, already have some working prototypes – but turned out need more opinions before moving forward with the idea and releasing this, kinda lost in doubts.
My main question - whether this seems interesting for someone here? Do you find this useful and see practical value?
-
Build and Deploy a gRPC-Web App Using Rust Tonic and React
By default, web browsers do not support gRPC, but we will use gRPC-web to make it possible.
-
Lemmy v0.18.0 Release - A reddit alternative written in Rust.
You just have to use a library implementation for JavaScript https://github.com/grpc/grpc-web
-
Full Stack Forays with Go and gRPC
TypeScript support remains an experimental feature of gRPC.
- Seeking Opinion: Choosing Between Gateway and Envoy Proxy for Our Microservices Architecture
-
Introducing Tempo: low latency, cross-platform, end-to-end typesafe APIs
The gRPC-Web protocol supports HTTP/1 and can be used from a browser.
-
gRPC on the client side
-- grpc-web
-
Introduction to gRPC
gRPC is mainly used in server-to-server communication, but it can also be used in client-to-server communication. gRPC-web is a gRPC implementation for web browsers. It is a JavaScript library that allows you to call gRPC services from a web browser. It supports Unary and Streaming Server API calls.
What are some alternatives?
supertest - 🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
ngx-grpc - Angular gRPC framework
Cypress - Fast, easy and reliable testing for anything that runs in a browser.
grpc-over-webrtc - gRPC over WebRTC
grpc-gateway - gRPC to JSON proxy generator following the gRPC HTTP spec
grpcurl - Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
api-guidelines - Microsoft REST API Guidelines
buf - The best way of working with Protocol Buffers.
google.aip.dev - API Improvement Proposals. https://aip.dev/
webrpc - webrpc is a schema-driven approach to writing backend services for modern Web apps and networks
redoc - 📘 OpenAPI/Swagger-generated API Reference Documentation
evans - Evans: more expressive universal gRPC client