SDKs and publishing them¶
Each SDK oryva writes is a package ready for its registry. Push a tag such as v1.0.0 to the
SDK's repository, and its release workflow runs the tests and publishes the package. You set up
each registry once. After that, a release is a tag.
Name the packages¶
Out of the box, every package is named after the API. Choose your own names under targets in
oryva.yml:
targets:
python: { out: sdks/python, package: ledger, dist: acme-ledger, client: Ledger }
typescript: { out: sdks/typescript, package: "@acme/ledger" }
csharp: { out: sdks/csharp, namespace: Acme.Ledger }
go: { out: sdks/go, module: github.com/acme/ledger-go, package: ledger }
rust: { out: sdks/rust, package: acme-ledger }
java: { out: sdks/java, package: com.acme.ledger }
kotlin: { out: sdks/kotlin, package: com.acme.ledger }
ruby: { out: sdks/ruby, gem: acme_ledger }
php: { out: sdks/php, package: acme/ledger, namespace: Acme\Ledger }
With this config, Python users run pip install acme-ledger and from ledger import Ledger.
The oryva.yml reference has every option and its default.
What's in each package¶
Each output directory is a complete package:
README.mdcovers install, authentication, environments, errors, retries and pagination, with one example per method and a section on releasing.- One test per method, for the language's own test runner. Each test runs the method's README example against a mock built from the spec's examples, so the tests need no network and no credentials.
- Package metadata: the name, version and description, plus the license, repository URL and
authors from
oryva.yml. CHANGELOG.md, with an entry for every version oryva generated.llms.txt, a single file that tells an agent how to install the SDK, authenticate and call each method..github/workflows/release.yml, which tests and publishes the package when you push a tag..oryva/, which the next run reads. Commit it with the SDK.
The nine SDKs¶
| Language | Built on | Needs |
|---|---|---|
| Python | httpx and pydantic; sync and async clients |
Python 3.9 or later |
| TypeScript | no runtime dependencies | Node.js 18 or later, browsers, edge runtimes |
| C# | HttpClient and System.Text.Json; async methods that take a CancellationToken |
.NET 8 or later |
| Go | the standard library; context on every call, iterators for paging |
Go 1.24 or later |
| Rust | reqwest (rustls) and serde; async, inside a Tokio runtime |
Rust 1.85 or later |
| Java | java.net.http and Jackson; builders, built with Gradle |
Java 17 or later |
| Kotlin | coroutines, OkHttp and kotlinx.serialization; suspend methods and Flows |
Kotlin 2, Java 17 or later |
| Ruby | the standard library (net/http, json); keyword arguments |
Ruby 3.2 or later |
| PHP | any PSR-18 client, Guzzle by default; named arguments | PHP 8.2 or later |
Python and TypeScript are free. The other seven need an oryva key.
All nine behave the same way, each in its own language's idioms. Every SDK picks the right
credentials for each call and walks pages for you. It retries rate limits and server errors,
honouring Retry-After. It also streams server-sent events, uploads and downloads files, and
verifies webhook signatures. SDK behaviour has the full contract.
Set the package metadata¶
Registries show a package's license, source repository and authors. Some refuse a package without
them. oryva copies them from oryva.yml and never makes them up:
license: Apache-2.0 # an SPDX license id
repository: https://github.com/acme/ledger-sdks
authors: [Acme]
If a registry needs a field you left out, the release workflow fails at its first step and names the field:
| Registry | Needs |
|---|---|
| npm | repository, for provenance |
| crates.io | license |
| Maven Central | license, repository and authors |
| RubyGems | authors |
Go has no such fields. pkg.go.dev reads the repository's LICENSE file.
Publish¶
Give each SDK its own repository, with the SDK at the root. GitHub runs only the workflows in a
repository's top-level .github/workflows, and each registry links the package to that
repository.
The release runs when you push a tag of v and the package's version, such as v1.0.0. A tag
that doesn't match the version fails the release. The workflow has two jobs: the first tests and
builds the package, and only the second can publish it.
Set up each registry once, before the first release:
| Language | Registry | Secrets needed |
|---|---|---|
| Python | PyPI | none (trusted publishing, environment pypi) |
| TypeScript | npm | none (trusted publishing, with provenance) |
| C# | NuGet | none (trusted publishing); repository variable NUGET_USER |
| Go | Go module proxy, pkg.go.dev | none |
| Rust | crates.io | none (trusted publishing, after a first cargo publish by hand) |
| Java | Maven Central | MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD, MAVEN_SIGNING_KEY, MAVEN_SIGNING_PASSWORD |
| Kotlin | Maven Central | as Java |
| Ruby | RubyGems | none (trusted publishing, after a first gem push by hand) |
| PHP | Packagist | none; Packagist publishes each tag through its GitHub hook |
The Releasing section of each generated README repeats these steps for that package.
Python¶
On pypi.org, add the repository and its release.yml as a trusted publisher of the package, with
environment pypi.
TypeScript¶
On npmjs.com, add the repository and its release.yml as a trusted publisher of the package. npm
checks the provenance against the repository URL, so set repository in oryva.yml.
C¶
On nuget.org, add a trusted publishing policy for the repository and workflow. Then set the
repository variable NUGET_USER to your nuget.org user name.
Go¶
A Go module is published by its git tag. The workflow vets and tests the module, then asks the Go module proxy for the new version, which also lists it on pkg.go.dev.
The module path must match where the repository lives, so set targets.go.module. From v2 on, end
it with the major version, such as /v2. pkg.go.dev shows documentation only for a module with a
license it recognises, so add a LICENSE file to the repository.
Rust¶
Publish the first version by hand with cargo publish. Then, in the crate's settings on
crates.io, add the repository and workflow as a trusted publisher. crates.io needs license.
Java and Kotlin¶
Verify the package's namespace on central.sonatype.com. Then set four repository secrets:
MAVEN_CENTRAL_USERNAMEandMAVEN_CENTRAL_PASSWORD: a Central Portal user token.MAVEN_SIGNING_KEY: an ASCII-armored PGP private key whose public key is on a key server.MAVEN_SIGNING_PASSWORD: that key's passphrase.
Maven Central needs license, repository and authors.
Ruby¶
Build and push the first version by hand with gem build and gem push. Then, on rubygems.org,
add the repository and workflow as a trusted publisher of the gem. RubyGems won't build a gem
without authors.
PHP¶
Submit the repository on packagist.org once. Packagist adds a hook to the GitHub repository, and
every tag you push becomes a version. The workflow only runs composer validate and the tests.
Versions¶
oryva sets each package's version. The first comes from version in oryva.yml, or else from the
spec's info.version. Each later run bumps it from what changed in the spec and adds an entry to
CHANGELOG.md. CI and regeneration has the rules.