Skip to content

oryva.yml

Keep this open while you write or change oryva.yml, the file that sets which spec oryva reads, what it generates, where, and under which names.

oryva generate with no arguments reads ./oryva.yml; --config <path> reads another. Paths in the file are relative to the file. Every field but spec is optional. An unknown key is an error, and so is a key that names something the spec doesn't have.

Example

spec: openapi.yaml
name: ledger              # overrides x-oryva-name
version: 1.4.0            # the first SDK version (SemVer)
license: Apache-2.0       # an SPDX id, for every package
repository: https://github.com/acme/ledger-sdks
authors: [Acme]
key_file: .oryva-license  # a file holding the oryva key; never the key itself
targets:
  python: { out: sdks/python, package: ledger, dist: ledger-sdk, client: Ledger }   # package may be dotted: acme.ledger
  mcp: { out: sdks/mcp, tool_budget: 10000 }
  typescript: { out: sdks/typescript, package: "@acme/ledger", client: Ledger }
  csharp: { out: sdks/csharp, namespace: Acme.Ledger, client: LedgerClient }
  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 }
environments:             # replaces the spec's servers; the first is the default
  production: https://api.acme.example
  sandbox: https://sandbox.acme.example
operations:               # per operation, keyed by "<method> <path>"
  get /customers/{customer_id}: { name: customers.retrieve }         # resource.method
  get /customers/{customer_id}/notes: { name: customers.notes.list }  # a nested resource
  get /customers: { pagination: { style: cursor, param: after, next_cursor: [next_cursor], items: [data] } }
  post /customers: { response: CustomerCreateResponse }              # the type it returns
models:                   # a components.schemas key -> the model's name
  CustomerRecord: Customer
credentials:              # a security scheme -> the variable its credential is read from
  BearerAuth: LEDGER_SECRET_KEY

Top-level fields

Field Meaning
spec The OpenAPI 3.0 or 3.1 spec, YAML or JSON. Required.
name The API's name, which names the packages, the output directory and the environment variables. Overrides x-oryva-name in the spec. Default: x-oryva-name, else the first word of the spec's title (skipping The, A or An), in snake_case.
version The SDKs' first version, as SemVer, such as 1.0.0 or 1.0.0-beta.1. Later runs bump it from what changed; set it higher to jump ahead. Default: from the spec's info.version.
license An SPDX license id for every package's metadata. oryva never picks one.
repository The source repository's URL, for every package's metadata.
authors A list of authors, for every package's metadata.
key_file A file that holds the oryva key, relative to oryva.yml. ORYVA_KEY wins over it. See oryva keys.
targets What to generate and where; see below. Default: every target, under out/<name>/<target>.
environments Environment name to base URL. Replaces the spec's servers; the first is the default.
operations Per-operation settings, keyed by <method> <path>; see below.
models Renames models: a components.schemas key to the model's name.
credentials A components.securitySchemes key to the environment variable its credential is read from. It also names the client's argument for it: the variable without <NAME>_, in lower case, so with name: ledger, LEDGER_SECRET_KEY is secret_key.

Where a registry needs license, repository or authors and they are not set, the SDK's release workflow fails and names the key. See SDKs and publishing them.

targets

List the targets to generate. A target you leave out is skipped. Without targets, oryva generates all of them, and skips the ones that need an oryva key when there is none. Every target takes out, its output directory; the default is out/<name>/<target>.

Target Option Meaning Default
python package The import package. May be dotted (acme.ledger) for a namespace package. <name>
dist The distribution name on PyPI. package with - for _
client The client class, when <name> in PascalCase gets it wrong (OpenAI). <name> in PascalCase
mcp tool_budget Tokens of tool definitions before the server switches to search, describe and call. 0 always does. See any API size. 10000
typescript package The npm package name. <name> with - for _
client The client class. <name> in PascalCase
csharp namespace The namespace, assembly and NuGet package id. <name> in PascalCase
client The client class. <name> in PascalCase, then Client
go module The module path. It must be where the repository lives. <name> without _
package The package name. <name> without _
rust package The crate name. <name> with - for _
java package The Java package, also the Maven group. com.<name>
kotlin package The Kotlin package, also the Maven group. com.<name>
ruby gem The gem name. It also names the module: acme_ledger is AcmeLedger. <name>
authors, license Override the top-level ones for the gem.
php package The Composer package, vendor/name. <name>/<name>
namespace The PHP namespace. <name> in PascalCase
authors, license Override the top-level ones for the package.

The MCP server wraps the Python SDK. Its package and command are the Python dist name with -mcp added. Its image installs the SDK from the python target's output directory, or from PyPI when the config has no python target.

operations

Keys are <method> <path> as in the spec, such as get /customers/{customer_id}. Each takes:

Option Meaning
name resource.method, or parent.resource.method for a nested resource. Like x-oryva-resource and x-oryva-method on the operation.
pagination As x-oryva-pagination on the operation; see spec extensions.
response The name of the type the method returns, or of each item for a paginated method. When other operations use the same schema, the name becomes an alias of it.

A dotted resource nests: Python, TypeScript, Go, Java, Kotlin and C# call it as client.customers.notes.list() in their own casing, the other SDKs as client.customers_notes.

Output directories

Each output directory gets .oryva/manifest.json, listing the files oryva wrote and their hashes, and .oryva/ir.json, the API model it used. Commit them with the SDK. The next run uses them to find what changed, to refuse to overwrite files you edited, and to delete files the new output no longer has. See CI and regeneration.