TeaDSL: A Multi-language SDK Solution for All API Gateways

Background

Problems with OpenAPIs

Figure 1. 1st-generation OpenAPIs are composed of interfaces and have ill-defined documentation.
Figure 2. 2nd-generation OpenAPIs can be implemented by SDKs, but this implementation is only supported by a few languages.
Figure 3. As the number of consumers increases, OpenAPI providers need to develop a more comprehensive set of tools and offer support for more programming languages.
Figure 4. Multiple kinds of OpenAPIs and API gateways are used as the platform of a company grows.

How TeaDSL Works

Figure 5. The workload for providing SDKs in N programming languages for M gateways is M * N.
Figure 6. The workload becomes M + N with the aid of TeaDSL.

TeaDSL and API Gateways

Design of New Standards

{
protocol: string, // http or https
port: number, // tcp port
host: string, // domain
request: {
method: string, // http method
pathname: string, // path name
query: map[string]string, // query string
headers: map[string]string, // request headers
body: readable // request body
},
response: {
statusCode: number, // http method
statusMessage: string, // path name
headers: map[string]string, // response headers
body: readable // response body
},
}
model User {
username: string,
age: number
}
toJSON(user: User): string
toXML(user: User): string
__request.body = toJSON(user);
__request.body = toXML(user);
api getUser(username: string): User {
__request.method = 'GET';
__request.pathname = `/users/${username}`;
__request.headers = {
host = 'hostname',
};
} returns {
var body = readAsJSON(__response.body);
return body;
}
function toXML(data: $Model): string;
function toJSON(data: $Model): string;

TeaDSL and Programming Languages

Summary

Original Source:

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tools I use as a web developer.

Big Data Play Ground for Engineers: Dump Twitter Stream into Kafka topic

3 Possible Pitfalls Of Using a Recruitment Agency

How to Dockerize your ASP.NET core application from scratch.

Cloud Dataflow

How to Sustain a Growing Platform and Gain Online Users

Estimating average document size in a MongoDB collection

StatsD. Which implementation is still alive?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Rapid App Development with Azure Spring Cloud Enterprise

Mocking GCP DatastoreRepository::performTransaction with MockK

Quarkus & Knative — Canary Deployment

Configuring Keycloak as an identity Provider in WSO2 Identity Server