Skip to content

Commit b1cc2e8

Browse files
Initial open source release
Rust code generator for strongly-typed structs, HTTP clients, and SSE streaming clients from OpenAPI 3.1 specifications. Originally built internally at GPU CLI for generating typed Rust clients for OpenAI, Anthropic, and other APIs. - Full OpenAPI 3.1 support (objects, arrays, enums, oneOf, anyOf, allOf, discriminators) - HTTP client generation with retry, tracing, and auth middleware - SSE streaming client generation with reconnection - TOML configuration and CLI binary (openapi-gen) - 156 tests, zero unwrap() in production code, clippy clean Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit b1cc2e8

174 files changed

Lines changed: 44626 additions & 0 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: dtolnay/rust-toolchain@stable
18+
- uses: Swatinem/rust-cache@v2
19+
- run: cargo test --all-features
20+
21+
clippy:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: dtolnay/rust-toolchain@stable
26+
with:
27+
components: clippy
28+
- uses: Swatinem/rust-cache@v2
29+
- run: cargo clippy --all-features -- -D warnings
30+
31+
fmt:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@stable
36+
with:
37+
components: rustfmt
38+
- run: cargo fmt --check
39+
40+
doc:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: dtolnay/rust-toolchain@stable
45+
- uses: Swatinem/rust-cache@v2
46+
- run: cargo doc --no-deps --all-features
47+
env:
48+
RUSTDOCFLAGS: -D warnings

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target
2+
Cargo.lock
3+
*.swp
4+
*.swo
5+
*~
6+
.DS_Store

Cargo.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[package]
2+
name = "openapi-generator"
3+
version = "0.1.0"
4+
edition = "2024"
5+
rust-version = "1.85.0"
6+
authors = ["James Lalonde"]
7+
license = "MIT"
8+
description = "Generate strongly-typed Rust structs, HTTP clients, and SSE streaming clients from OpenAPI 3.1 specifications"
9+
repository = "https://github.com/jameslal/openapi-generator"
10+
keywords = ["openapi", "codegen", "rust", "sse", "api-client"]
11+
categories = ["development-tools", "web-programming"]
12+
readme = "README.md"
13+
14+
[dependencies]
15+
clap = { version = "4.5", features = ["derive"] }
16+
once_cell = "1.19"
17+
prettyplease = "0.2"
18+
proc-macro2 = "1.0"
19+
quote = "1.0"
20+
reqwest = { version = "0.11", features = ["json", "blocking", "stream"] }
21+
reqwest-middleware = "0.4"
22+
reqwest-retry = "0.7"
23+
serde = { version = "1.0", features = ["derive"] }
24+
serde_json = "1.0"
25+
serde_yaml = "0.9"
26+
syn = { version = "2.0", features = ["parsing"] }
27+
thiserror = "1.0"
28+
tokio = { version = "1.0", features = ["full"] }
29+
tempfile = "3.0"
30+
insta = { version = "1.41", features = ["yaml"] }
31+
url = "2.5"
32+
toml = "0.8"
33+
validator = { version = "0.20", features = ["derive"] }
34+
specta = { version = "2.0.0-rc", features = ["derive"], optional = true }
35+
heck = "0.5"
36+
37+
[dev-dependencies]
38+
serde_yaml = "0.9"
39+
insta = { version = "1.41", features = ["yaml"] }
40+
41+
[features]
42+
specta = ["dep:specta"]
43+
44+
[[bin]]
45+
name = "openapi-gen"
46+
path = "src/bin/openapi-gen.rs"
47+
48+
[lints.clippy]
49+
unwrap_used = "deny"
50+
expect_used = "warn"

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) 2025 James Lalonde
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.

0 commit comments

Comments
 (0)