by ThomasRooney · 4y ago · 0 comments
Here's a few examples:
1. The Petstore API (an tiny example): https://easysdk.xyz/sdk/petstore.json-7bb7c53e017c0f7432f7bd...
2. Our own API: https://easysdk.xyz/sdk/openapi.yaml-ee89154ee9cf9a77f9fb07d...
3. The LOTR API: http://easysdk.xyz/sdk/lotr.yaml-f1ec4cde1ca7839dca2685e283e...
The generator works by:
1. Dereferencing an OpenAPI specification into something with inline types. (Ideally we'd handle type references rather than inlining them, but haven't got there yet)
2. Walking the type-graph, and mapping it to Operations (a combination of Path and Method).
3. Using the Typescript SDK, generating the SDK via creating AST nodes whilst walking the type graph.
4. Trying to compile in:
1. Path Parameters as ES6 Template strings (e.g. `"/v1/apis/{apiID}/api_endpoints"` => `/v1/apis/${props.apiID}/api_endpoints`)
2. Query params into axios parameters
3. Body params as an additional argument to the SDK
It's not perfect, but we've used this to help run our own unit tests (and have a few customers trying it out too)! Happy to answer any questionsNo comments yet.