Skip to content

Commit 4ec3798

Browse files
Merge pull request #46 from gpu-cli/agent/storyden-generator-fixes
ci: publish playground wasm only on release tags
2 parents 5669894 + 2c08984 commit 4ec3798

31 files changed

Lines changed: 16059 additions & 218 deletions

.beads/issues.jsonl

Lines changed: 13 additions & 0 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
specs/storyden.yaml whitespace=-trailing-space

.github/workflows/playground-wasm.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
name: Playground WASM
22

3-
# Builds the website playground's WASM bundle whenever the generator changes,
4-
# publishes it as a public release asset, and bumps website/playground-wasm.lock.
3+
# Builds the website playground's WASM bundle for each release tag, publishes it
4+
# as a public release asset, and bumps website/playground-wasm.lock on main.
55
# The lock-bump commit triggers Vercel's git auto-deploy, whose build fetches
66
# the asset via website/scripts/fetch-playground-wasm.mjs. No Vercel secrets.
7-
#
8-
# Self-retrigger is impossible by construction: the lock file lives under
9-
# website/, outside this workflow's path filter.
107

118
on:
129
push:
13-
branches: [main]
14-
paths:
15-
- "src/**"
16-
- "wasm/**"
17-
- "Cargo.toml"
18-
- "Cargo.lock"
19-
- "scripts/build-playground-wasm.sh"
10+
tags: ["v*"]
2011
workflow_dispatch:
2112

2213
permissions:
@@ -46,6 +37,7 @@ jobs:
4637
run: ./scripts/build-playground-wasm.sh
4738

4839
- name: Package and publish release asset
40+
id: publish
4941
env:
5042
GH_TOKEN: ${{ github.token }}
5143
run: |
@@ -58,13 +50,22 @@ jobs:
5850
--prerelease \
5951
--title "Playground WASM $version (${GITHUB_SHA::7})" \
6052
--notes "WASM bundle for openapi-to-rust.dev/playground, built from ${GITHUB_SHA}."
61-
echo "$tag" > website/playground-wasm.lock
53+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
6254
6355
- name: Commit lock bump
64-
# Pushes back to the ref the workflow ran on: main for the normal
65-
# push-triggered flow, the dispatched branch for pre-merge test runs.
56+
# Tag-triggered runs update main. Manual pre-merge runs update the
57+
# branch they were dispatched from.
58+
env:
59+
WASM_RELEASE_TAG: ${{ steps.publish.outputs.tag }}
6660
run: |
6761
set -euo pipefail
62+
target_branch="$GITHUB_REF_NAME"
63+
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
64+
target_branch="main"
65+
fi
66+
git fetch origin "$target_branch"
67+
git checkout -B "$target_branch" "origin/$target_branch"
68+
echo "$WASM_RELEASE_TAG" > website/playground-wasm.lock
6869
if git diff --quiet -- website/playground-wasm.lock; then
6970
echo "lock unchanged; nothing to deploy"
7071
exit 0
@@ -73,5 +74,4 @@ jobs:
7374
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
7475
git add website/playground-wasm.lock
7576
git commit -m "chore: bump playground wasm to $(cat website/playground-wasm.lock) [skip ci]"
76-
git pull --rebase origin "$GITHUB_REF_NAME"
77-
git push origin "HEAD:$GITHUB_REF_NAME"
77+
git push origin "HEAD:$target_branch"

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ scripts/spec-compile.sh anthropic openai # generator/client output
7777
scripts/spec-compile.sh # broad generator/type changes
7878
```
7979

80-
The full corpus generates and compile-checks 54 OpenAPI documents and can take
80+
The full corpus generates and compile-checks 55 OpenAPI documents and can take
8181
several minutes. CI runs a fast generation tier on pull requests and the full
8282
compile tier weekly or on manual dispatch.
8383

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ committed output.
3232

3333
We originally built this internally at [GPU CLI](https://gpu-cli.sh) to generate typed Rust clients for OpenAI, Anthropic, Cloudflare, and other large APIs. After battle-testing it against real-world specs with complex union types, discriminated enums, streaming endpoints, and the occasional spec/API drift, we decided to open source it.
3434

35-
The repository contains **55 real-world specs**. The supported OpenAPI corpus is
36-
54 specs (one Gitea document is Swagger 2.0 and intentionally skipped). Pull
35+
The repository contains **56 real-world specs**. The supported OpenAPI corpus is
36+
55 specs (one Gitea document is Swagger 2.0 and intentionally skipped). Pull
3737
requests compile-check the OpenAI and Anthropic production specs; a scheduled
38-
and manually runnable CI tier checks all 54 OpenAPI specs.
38+
and manually runnable CI tier checks all 55 OpenAPI specs.
3939

4040
Release history and breaking changes live in the [changelog](CHANGELOG.md).
4141

@@ -110,6 +110,7 @@ enable_async_client = true
110110
[http_client]
111111
base_url = "https://api.example.com"
112112
timeout_seconds = 30
113+
max_response_body_bytes = 8388608
113114

114115
[http_client.retry]
115116
max_retries = 3
@@ -261,6 +262,7 @@ use crate::generated::types::*;
261262
async fn main() -> Result<(), Box<dyn std::error::Error>> {
262263
let client = HttpClient::new()
263264
.with_base_url("https://api.example.com")
265+
.with_max_response_body_bytes(8 * 1024 * 1024)
264266
.with_api_key(std::env::var("API_KEY")?);
265267

266268
let req = CreateResourceRequest { /* … */ };
@@ -269,6 +271,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
269271
}
270272
```
271273

274+
Generated clients cap every response they buffer in memory at 8 MiB by
275+
default. Set `http_client.max_response_body_bytes` when generating, or use the
276+
runtime builder above for a particular client. If a cumulative chunked or
277+
fixed-length body crosses the limit, the call returns
278+
`HttpError::ResponseTooLarge { limit }` before appending the chunk that would
279+
exceed it. Successful SSE responses remain streaming; only SSE error responses
280+
are buffered under the same cap.
281+
272282
## What the generated types look like
273283

274284
A tour of patterns the generator emits, from real outputs.
@@ -572,6 +582,7 @@ registry_only = false # only generate the registry (skip types
572582
[http_client]
573583
base_url = "https://api.example.com"
574584
timeout_seconds = 30 # 1-3600
585+
max_response_body_bytes = 8388608 # buffered responses; 8 MiB default
575586

576587
[http_client.retry]
577588
max_retries = 3 # 0-10
@@ -665,10 +676,10 @@ scripts/spec-compile.sh # generate + cargo-check every spec in specs/ (full co
665676

666677
The compile tiers are intentionally different:
667678

668-
- Every pull request and push to `main` generates all 54 supported OpenAPI
679+
- Every pull request and push to `main` generates all 55 supported OpenAPI
669680
specs, then compile-checks the Anthropic and OpenAI production specs against
670681
each generated `REQUIRED_DEPS.toml`.
671-
- Weekly scheduled CI and manual workflow runs compile-check all 54 supported
682+
- Weekly scheduled CI and manual workflow runs compile-check all 55 supported
672683
OpenAPI specs. The bundled Gitea Swagger 2.0 document is reported as skipped.
673684
- Local `scripts/spec-compile.sh` runs the same full tier; pass spec names as
674685
arguments for a smaller targeted run.

examples/complete_workflow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ fn demonstrate_rust_api(
292292
http_client_config: Some(HttpClientConfig {
293293
base_url: Some("https://api.example.com".to_string()),
294294
timeout_seconds: Some(30),
295+
max_response_body_bytes: Some(8 * 1024 * 1024),
295296
default_headers: {
296297
let mut headers = std::collections::HashMap::new();
297298
headers.insert("content-type".to_string(), "application/json".to_string());

specs/download.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ download "cloudflare-dns" \
232232
"https://raw.githubusercontent.com/cloudflare/api-schemas/main/openapi.json" \
233233
"cloudflare-dns.json"
234234

235+
# --- Community Platforms ---
236+
download "storyden" \
237+
"https://raw.githubusercontent.com/Southclaws/storyden/main/api/openapi.yaml" \
238+
"storyden.yaml"
239+
235240
# --- Misc DevTools ---
236241
download "railway" \
237242
"https://docs.railway.com/reference/public-api-spec.json" \

0 commit comments

Comments
 (0)