4 ms·
> I love the idea of an IDL for describing APIs and a great compiler/codegen (protoc) Me too. My context is that I end up using RPC-ish patterns when doing sli
by crabmusket 2y ago
> I love the idea of an IDL for describing APIs and a great compiler/codegen (protoc)
Me too. My context is that I end up using RPC-ish patterns when doing slightly out-of-the-ordinary web stuff, like websockets, iframe communications, and web workers.
In each of those situations you start with a bidirectional communication channel, but you have to build your own request-response layer if you need that. JSON-RPC is a good place to start, because the spec is basically just "agree to use `id` to match up requests and responses" and very little else of note.
I've been looking around for a "minimum viable IDL" to add to that, and I think my conclusion so far is "just write out a TypeScript file". This works when all my software is web/TypeScript anyway.
- dpeckett 2y agoNow that's an interesting thought, I wonder if you could use a modified subset of TypeScript to create a IDL/DDL for JSON-RPC. Then compile that schema into implementations for various target languages.
- IggleSniggle 2y agoTypia kinda does this, but currently only has a Typescript -> Typescript compiler.
- crabmusket 2y agoYeah that's what I'd look into. Maybe TS -> Json Schema -> target language.