Moving from Stainless¶
Your users' code is full of calls like client.chat.completions.create(...). A new generator is
safe to adopt when every one of those calls keeps working. Three commands make the switch and
show you which calls survive:
oryva import stainless openapi.stainless.yml openapi.yaml # writes ./oryva.yml
oryva generate
oryva compat ../acme-python # the old SDK's repository
oryva import stainless carries your Stainless config over, so the new SDKs keep the old names.
oryva compat then lists every place where code written against the old SDK would break. Both
need an oryva key in ORYVA_KEY.
Import the Stainless config¶
Run the import in the repository that holds your spec and your Stainless config:
Wrote oryva.yml: 5 methods named, 1 models renamed, 2 environments.
Not imported:
- organization.docs: not used by oryva
- organization.contact: not used by oryva
- targets.python.production_repo: not used by oryva
...
- settings: no oryva equivalent
- query_settings: no oryva equivalent
Next: `oryva generate`, then `oryva compat <old SDK directory>`.
The import keeps the SDK's public API:
- resource and method names, nested resources included;
- model names, and the type each method returns (Stainless's
<Resource><Method>Response); - the client's name and its credential variables;
- package names for every target oryva has;
- environments and pagination.
It lists every setting it could not carry over. It refuses to overwrite an existing oryva.yml.
And because there is no oryva.yml yet, it reads the key from ORYVA_KEY only.
Compare with the old SDK¶
Generate, then compare each new SDK with the old one's repository:
oryva generate
oryva compat ../acme-python
oryva compat ../acme-java --lang java # Stainless writes its Java SDKs in Kotlin
oryva compat reads the public API of the old SDK, and of the SDK oryva generates from oryva.yml
in the same language. It lists the differences in oryva diff's format:
# API changes
## Minor (13)
- AsyncBookshelf: param default_headers added
- AsyncBookshelf: param default_query added
- Bookshelf: param default_headers added
- Bookshelf: param default_query added
- authors.retrieve: param max_retries added
...
Additions are minor changes. compat exits with 1 when code written against the old SDK would break:
- a client, option, resource, method, parameter, model or field is gone or renamed;
- a parameter became required, moved, or can no longer be passed by position;
- a list method no longer returns pages.
compat works out the language from the directory; --lang overrides it. It reads each SDK with
that language's own tools, so they must be on PATH:
| SDK | What it compares | Reads it with |
|---|---|---|
| Python | client classes and their arguments, client.<resource>.<method>(...), the models <package>.types exports |
python3 (ast) |
| TypeScript | the default-exported client and its options, every method (positional arguments by position, fields of a params object by name), the models on the client's namespace (Acme.Book) |
npx, which fetches typescript@5.9.3 |
| Go | NewClient and the With... options, every service method (arguments by position, params struct fields by name), every exported type |
go run (go/parser) |
| Java, Kotlin | the client's builder or constructor, every method by name and parameter types (a Kotlin default adds the shorter overloads), every public type with its methods and builder | gradle: javac's parser and the Kotlin compiler's, version 2.4.21 |
| C# | the client's constructor and settable properties, every method (by name or position, and the properties of a params object), every public type with its properties | dotnet, with the Roslyn that ships in the SDK |
compat doesn't compare the types of arguments and fields. It checks return types only for pages,
in Python, TypeScript and Go. Python and TypeScript skip the per-method ...Params types, whose
fields are the methods' arguments anyway. The other languages compare them, because callers name
them. compat doesn't read Ruby or PHP SDKs yet.
What to expect¶
We ran this on public Stainless SDKs. "Unchanged" counts the old SDK's methods that kept the same path from the client, the same name and arguments, and still page:
| SDK | API size | Python methods unchanged | TypeScript methods unchanged |
|---|---|---|---|
| Cerebras | 4 endpoints | 4/4 | 4/4 |
| Browserbase | 18 endpoints | 18/18 | 18/18 |
| OpenAI | 279 endpoints | 255/320 | 243/306 |
| SDK | Language | Methods unchanged |
|---|---|---|
| Terminal | Go | 33/37 |
| ImageKit | Go | 55/64 |
| OpenAI | Go | 261/319 |
| Terminal | Java | 61/115 |
| ImageKit | Java | 149/300 |
| OpenAI | Java | 536/1467 |
| Terminal | Kotlin | 50/115 |
| ImageKit | C# | 0/85 |
Most of what's left in OpenAI's Python and TypeScript SDKs is one of three things:
- code OpenAI wrote by hand, such as
parse,streamandpollhelpers; - types that a config derived from the SDK can't name, because OpenAI doesn't publish its Stainless config;
- things oryva doesn't generate yet: methods on the client itself, client options sent as headers, such as an organization id, and list methods that page by their last item's id or aren't paginated at all.
Go, Java, Kotlin and C# keep Stainless's resource paths. Go, Java and Kotlin also keep its method
and params type names, as in client.Folders.New(ctx, imagekit.FolderNewParams{...}). They differ
more in shape:
- Stainless puts Go options in an
optionpackage. - It builds Java and Kotlin clients with
<Name>OkHttpClient.builder(), and passes every Java and Kotlin method a params object. - Its C# methods drop the
Asyncsuffix.
Stainless compatibility results has every number, the versions compared, and what is left in each SDK.