Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit febf398

Browse files
authored
Initial commit
0 parents  commit febf398

File tree

1,483 files changed

+148475
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,483 files changed

+148475
-0
lines changed

.github/workflows/sdk_generation.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Generate
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
"on":
8+
workflow_dispatch:
9+
inputs:
10+
force:
11+
description: Force generation of SDKs
12+
type: boolean
13+
default: false
14+
schedule:
15+
- cron: 0 0 * * *
16+
jobs:
17+
generate:
18+
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
19+
with:
20+
force: ${{ github.event.inputs.force }}
21+
mode: pr
22+
speakeasy_version: latest
23+
secrets:
24+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
25+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.speakeasy/workflow.lock

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
speakeasyVersion: 1.396.2
2+
sources:
3+
accounting:
4+
sourceNamespace: accounting
5+
sourceRevisionDigest: sha256:430a64de9ff4076a9a5a65bc6528cf4105eb847dc12d69ea0214f4959846771d
6+
sourceBlobDigest: sha256:5f1cc761dc56e7ca4021510061eebb912db4ba7736e61c5a9ccd633a416c2611
7+
tags:
8+
- latest
9+
- main
10+
lending:
11+
sourceNamespace: lending
12+
sourceRevisionDigest: sha256:178885971cf1c04155e742359cad4b10d0eba3a8d7de8e7a64d2e33a0678995d
13+
sourceBlobDigest: sha256:fa9d95b78d45713a72c0e0606cd94aab70c76d28d8edb2c33545d078dc15d36b
14+
tags:
15+
- latest
16+
- main
17+
targets:
18+
accounting-ts:
19+
source: accounting
20+
sourceNamespace: accounting
21+
sourceRevisionDigest: sha256:430a64de9ff4076a9a5a65bc6528cf4105eb847dc12d69ea0214f4959846771d
22+
sourceBlobDigest: sha256:5f1cc761dc56e7ca4021510061eebb912db4ba7736e61c5a9ccd633a416c2611
23+
outLocation: ./accounting
24+
lending-ts:
25+
source: lending
26+
sourceNamespace: lending
27+
sourceRevisionDigest: sha256:178885971cf1c04155e742359cad4b10d0eba3a8d7de8e7a64d2e33a0678995d
28+
sourceBlobDigest: sha256:fa9d95b78d45713a72c0e0606cd94aab70c76d28d8edb2c33545d078dc15d36b
29+
outLocation: ./lending
30+
workflow:
31+
workflowVersion: 1.0.0
32+
speakeasyVersion: latest
33+
sources:
34+
accounting:
35+
inputs:
36+
- location: accounting.yaml
37+
registry:
38+
location: registry.speakeasyapi.dev/sagar-demo/sagar-demo/accounting
39+
lending:
40+
inputs:
41+
- location: lending.yaml
42+
registry:
43+
location: registry.speakeasyapi.dev/sagar-demo/sagar-demo/lending
44+
targets:
45+
accounting-ts:
46+
target: typescript
47+
source: accounting
48+
output: ./accounting
49+
lending-ts:
50+
target: typescript
51+
source: lending
52+
output: ./lending

.speakeasy/workflow.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
workflowVersion: 1.0.0
2+
speakeasyVersion: latest
3+
sources:
4+
accounting:
5+
inputs:
6+
- location: accounting.yaml
7+
registry:
8+
location: registry.speakeasyapi.dev/sagar-demo/sagar-demo/accounting
9+
lending:
10+
inputs:
11+
- location: lending.yaml
12+
registry:
13+
location: registry.speakeasyapi.dev/sagar-demo/sagar-demo/lending
14+
targets:
15+
accounting-ts:
16+
target: typescript
17+
source: accounting
18+
output: ./accounting
19+
lending-ts:
20+
target: typescript
21+
source: lending
22+
output: ./lending

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Speakeasy SDKs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Template SDK Monorepo
2+
3+
<div align="left">
4+
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
5+
</div>
6+
7+
## How to use this repository
8+
9+
> :warning: This is an advanced setup process. For most cases we reccomend using the single sdk per github repository approach. Please see this [repo](https://github.com/speakeasy-sdks/template-sdk) for the corresponding template.
10+
11+
**👀** This template repository is designed to bootstrap a monorepo of SDKs following this [guide](https://github.com/speakeasy-sdks/template-sdk-monorepo?tab=readme-ov-file) and using Github's repository clone feature. Once this repository is setup it will automatically keep your SDKs up to date and published to a package manager.
12+
13+
## What is a SDK monorepo ?
14+
15+
A SDK monorepo is a single github repository that houses multiple SDKs. Each SDK corresponds to a single OpenAPI specification. This is a style of SDK popularised by AWS that enables discovery of all available SDKs in one repo but requires download of individual SDKs corresponding to API/business groups.
16+
17+
Each SDK is housed in its own subfolders and have independent github workflows that manage re-generation and release of code. In this example we have two SDKs: Accounting and Lending that can be found in their own sub folders. The general structure is as follows:
18+
19+
```yaml
20+
.github/workflows/ #This is standards github notation for storing workflow files on Github
21+
- sdk_generation.yaml # This controls execution of the speakeasy generation workflow file. Automatically created by speakeasy
22+
.speakeasy/workflows
23+
- workflow.yaml # This is the speakeasy workflow file that indicates what sources to use and targets to generate
24+
accounting # This folder houses the accounting SDK
25+
- gen.yaml # Generation config for the accounting SDK
26+
lending # This folder houses the lending SDK
27+
- gen.yaml # Generation config for the lending SDK
28+
```
29+
30+
This structure can be extrapoloated to N number of SDKs.
31+
32+
### Creating a Monorepo of SDKs
33+
34+
To create this repo for yourself you can either clone and fork the repository or follow the interactive commands with `speakeasy quickstart`, `speakeasy configure sources` and `speaekasy configure targets` to achieve a similar outcome.
35+
36+
Once you have the repo setup you run `speakeasy run` to (re)generate the SDK:
37+
38+
![CleanShot 2024-04-01 at 09 34 13@2x](https://github.com/speakeasy-sdks/template-sdk-monorepo/assets/68016351/a1c59329-77f7-4fbd-b928-f2ab89d6b37a)
39+
40+
🚀 You should have a working SDK for your API 🙂 . To check out all the features of the SDK please see our docs [site](https://speakeasyapi.dev/docs/create-client-sdks/).
41+
42+
### Local development
43+
44+
Once you have the SDK setup you may want to iterate on the SDK. Speakeasy supports OpenAPI vendor extensions that can be added to your spec to customize the SDK ergonomics (method names, namespacing resources etc.) and functionality (adding retries, pagination, multiple server support etc)
45+
46+
To get started install the Speakeasy CLI.
47+
48+
In your terminal, run:
49+
50+
```bash
51+
brew install speakeasy-api/homebrew-tap/speakeasy
52+
```
53+
Once you annonate your spec with an extension you will want to run `speakeasy validate` to check the spec for correctness and `speakeasy generate` to recreate the SDK locally. More documentation on OpenAPI extensions [here](https://speakeasyapi.dev/docs/customize-sdks/namespaces/). Here's an example of adding a multiple server support to the spec so that your SDK supports production and sandbox versions of your API.
54+
55+
```yaml
56+
info:
57+
title: Example
58+
version: 0.0.1
59+
servers:
60+
- url: https://prod.example.com # Used as the default URL by the SDK
61+
description: Our production environment
62+
x-speakeasy-server-id: prod
63+
- url: https://sandbox.example.com
64+
description: Our sandbox environment
65+
x-speakeasy-server-id: sandbox
66+
```
67+
68+
Once you're finished iterating and happy with the output push only the latest version of spec into the repo and regenerate the SDK using `speakeasy run`.

RELEASES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
## 2024-05-27 00:13:19
4+
### Changes
5+
Based on:
6+
- OpenAPI Doc
7+
- Speakeasy CLI 1.296.1 (2.338.1) https://github.com/speakeasy-api/speakeasy
8+
### Generated
9+
- [typescript v0.6.0] ./accounting
10+
11+
## 2024-09-12 00:14:53
12+
### Changes
13+
Based on:
14+
- OpenAPI Doc
15+
- Speakeasy CLI 1.396.2 (2.415.0) https://github.com/speakeasy-api/speakeasy
16+
### Generated
17+
- [typescript v0.3.0] lending

0 commit comments

Comments
 (0)