A Rust-based SDK generator that creates language-specific SDKs for the X API from OpenAPI specifications.
| Language | Package | Repo |
|---|---|---|
| Python | pip install xdk |
xdk-python |
| TypeScript | npm install @xdevplatform/xdk |
xdk-typescript |
xdk/
├── xdk-openapi/ # OpenAPI 3.0 parser
├── xdk-lib/ # Shared models and utilities
├── xdk-gen/ # Language generators (uses language! macro)
├── xdk-build/ # CLI tool
└── xdk-gen/templates/
├── python/ # Jinja2 templates for Python
└── typescript/ # Jinja2 templates for TypeScript
make python # Generate Python SDK to xdk/python/
make typescript # Generate TypeScript SDK to xdk/typescript/make check # Rust fmt + clippy
make test-generator # Rust unit tests
make test-python # Generate + test Python SDK
make test-typescript # Generate + test TypeScript SDKSee PUBLISHING.md. TL;DR: Go to Actions → Release SDK → Run workflow.
Add a new file in xdk-gen/src/<language>/:
// xdk-gen/src/go/generator.rs
use xdk_lib::language;
language! {
name: Go,
filters: [go_type, pascal_case, snake_case],
class_casing: Casing::Pascal,
operation_casing: Casing::Pascal,
variable_casing: Casing::Snake,
render: [
multiple {
render "models" => "{}/models.go",
render "client" => "{}/client.go",
},
render "main_client" => "client.go"
],
tests: [
multiple {
render "tests" => "{}_test.go",
}
]
}Add Jinja2 templates in xdk-gen/templates/<language>/:
xdk-gen/templates/go/
├── models.j2
├── client.j2
├── main_client.j2
└── tests.j2
Update xdk-gen/src/lib.rs to export your generator.
Update xdk-build/src/main.rs to add the CLI command.
Update xdk-config.toml:
[versions]
go = "0.1.0"Create xdevplatform/xdk-go with CI workflows (see existing SDK repos for examples).
Add the new language to .github/workflows/release.yml.
MIT