Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): integrates stainless client lib gen into ci #644

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

zcabter
Copy link
Collaborator

@zcabter zcabter commented Nov 8, 2024

Context

This PR sets up Stainless Github Action to automatically generate the client library and push changes to jstz-client repo. The auto generated bindings will be useful as we continue to evolve the Jstz node endpoints and communication bindings.

Generated code: https://github.com/jstz-dev/jstz-client

Description

  • Adds generate client job
  • Adds stainless.yaml config
  • Represents operation hash as byte array

Evaluation

Evaluation doc: https://docs.google.com/document/d/1kU_xjPYoHaqgmewAZlJDpkJ25FTNnccq8Wb88YQhcFk/edit?usp=sharing

Description Stainless
Code quality Coherent generated code: (M1) Separation by resource, (M2) Sensible calling conventions and method names, (M3) Able to return the body type and Response, async, (M4) Idiomatic use of Typescript (M5) Package size(M6) Fetch configurability (M1) + Types /Classes are separated by resource(M1) - Sub-resources are child types of resource ie. Type for subkey list is Jstz.Accounts.Kv.SubkeyListResponse(M2) + Calling convention are resource based ie. client.accounts.kv.subkeys.list(address)(M3) + Response are returned as Core.APIPromise, an awaitable promises that returns T or can be converted into Response with asResponse() or withResponse()(M4) + OO Typescript(M4) + Namespaces to void conflicts(M6) + Client customisation eg. timeout, retries, custom fetch, agent for managing connections (M6) ~ Streamable response support via fetch API - cannot mark endpoint as returning a stream (could be an OAS definition problem)
Runtime compatibility   Node.js, Deno, Bun, browsers, and variousedge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
Mock and testing   Fetch can be mocked
Customisability Degree and ease of customising the code generation + Method names, model references, and organisation can be controlled via stainless.yml config+ Patching with custom code by replaying patches for each generation
Language support   + Typescript- No Rust, not in roadmap~ SDK docs in roadmap
Developer experience   - No offline generation- No LSP to aid writing stainless configs~ Basic documentation
CI Integration Degree and ease of integrating into CI + GHA support- Dependent on Stainless platform to perform the code generation
Compatibility with OpenAPI 3.1 Utopia generates OAS v3.1 Yes

Manually testing the PR

@zcabter zcabter self-assigned this Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.23%. Comparing base (92e6a62) to head (838594a).
Report is 1 commits behind head on main.

Files with missing lines Coverage Δ
crates/jstz_proto/src/operation.rs 26.96% <100.00%> (+5.27%) ⬆️
crates/jstz_proto/src/receipt.rs 65.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92e6a62...838594a. Read the comment docs.


🚨 Try these New Features:

@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch 2 times, most recently from 3b1a94d to 918de34 Compare November 8, 2024 17:22
@zcabter zcabter changed the base branch from main to ryan-jstz-159@implement-openapi-for-logservice November 11, 2024 14:06
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch 3 times, most recently from bb1e123 to 4f88f0b Compare November 12, 2024 19:58
@zcabter zcabter force-pushed the ryan-jstz-159@implement-openapi-for-logservice branch from 77a9d2f to 33646e1 Compare November 13, 2024 10:29
Base automatically changed from ryan-jstz-159@implement-openapi-for-logservice to main November 13, 2024 10:55
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch from 4f88f0b to ee28e08 Compare November 14, 2024 16:56
@zcabter zcabter changed the base branch from main to ryan@fix-serde-on-enums November 14, 2024 16:57
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch 3 times, most recently from 430ce5a to 676d93d Compare November 14, 2024 19:35
@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch from 94b3709 to 0c177a9 Compare November 14, 2024 19:35
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch 13 times, most recently from fb69240 to f41b31a Compare November 15, 2024 14:03
@zcabter zcabter changed the base branch from ryan@fix-serde-on-enums to main November 15, 2024 14:09
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch 2 times, most recently from 88dfcc0 to d43aa2c Compare November 15, 2024 14:30
@zcabter zcabter mentioned this pull request Nov 15, 2024
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch from d43aa2c to 6f8d63b Compare November 15, 2024 18:42
@zcabter zcabter changed the base branch from main to ryan@fix-serde-on-enums November 15, 2024 18:43
@zcabter zcabter changed the title feat(ci): integerate stainless client lib gen into ci feat(ci): integrates stainless client lib gen into ci Nov 15, 2024
@zcabter zcabter assigned huancheng-trili and unassigned zcabter Nov 15, 2024
@zcabter
Copy link
Collaborator Author

zcabter commented Nov 15, 2024

Generating a new client sdk should only happen on main branch. The ci file needs to be updated before merging.

Copy link
Collaborator

@huancheng-trili huancheng-trili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be any issue if we move all changes to the source files to #663 and only keep the yaml files in this PR? I think that looks cleaner.

@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch from dacb60f to ed18ad5 Compare November 18, 2024 10:55
@zcabter
Copy link
Collaborator Author

zcabter commented Nov 18, 2024

Will there be any issue if we move all changes to the source files to #663 and only keep the yaml files in this PR? I think that looks cleaner.

Done

@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch from ed18ad5 to 716333c Compare November 18, 2024 10:57
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch from 6f8d63b to 97bf95b Compare November 18, 2024 11:03
Base automatically changed from ryan@fix-serde-on-enums to main November 18, 2024 11:17
@zcabter zcabter force-pushed the ryan-jstz-161@evaluate-and-patch-generate-libs branch from 97bf95b to 838594a Compare November 18, 2024 18:26
@zcabter zcabter merged commit 9ba5743 into main Nov 18, 2024
6 checks passed
@zcabter zcabter deleted the ryan-jstz-161@evaluate-and-patch-generate-libs branch November 18, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants