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

Six reasons staying upgraded

RISC-V: Baremetal From The Ground Up

Hybrid Cloud Storage: Cross-Cloud Replication

[Classic Pattern] “Sorted Stack” — Monotonous Stack

Fast and slow pointers

What is Serverless Computing? Serverless Architectures — XenonStack

Upgrading to Terraform 0.12 a short summary for AWS

Lighthouse CI setup with Jenkins

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

Mocking GCP DatastoreRepository::performTransaction with MockK

Deep Dive into Kong Authentication Plugin

The Power of Kafka

[Elasticsearch] How to use minimum_should_match and operator with match query?