DEV Community

Ted Neward
Ted Neward

Posted on

Cadl: a new IDL

This one just crossed my feed today: Cadl, "... a language for describing cloud service APIs and generating other API description languages, client and service code, documentation, and other assets."

In other words, you write this:

import "@cadl-lang/rest";

using Cadl.Http;

@server("https://example.com", "Single server endpoint")
@route("/example")
namespace Example {
  @get
  @route("/message")
  op getMessage(): string;
}
Enter fullscreen mode Exit fullscreen mode

... and when you "compile" it, you get an OpenAPI (or gRPC, or some other service-oriented protocol) specification out the other end. From there, it seems, you use other tools to go from OpenAPI to one of the service client or implementation languages (C#, Java, Python, Ruby, whatever suits your fancy), so long as there's an OpenAPI code generator for it.

First take: this seems so much less feature-rich than something like Ballerina, but I suppose it will appeal to those who prefer to get all their Azure-related tooling from Microsoft and/or prefer their stack to be entirely JS-based. (Cadl seems to be a product of TypeScript.)

Will plan on investigating this more, soon.

Top comments (0)