@oasis-gen/darwin-arm64
v0.8.0
Published
The oasis-gen binary for darwin-arm64
Readme
oasis-gen reads an OpenAPI document and writes one dependency-free TypeScript
file, with types for every operation and a small fetch-based runtime.
- OpenAPI 3.2:
QUERYoperations, sequential media types (JSON Lines, server-sent events), multi-file documents, and JSON Schema 2020-12. OpenAPI 3.0 and 3.1 documents are accepted too. - Strict types:
statusnarrowsdatato the declared response. Statuses that the document does not declare stay in the type. Request types respectreadOnlyandwriteOnly. - Zero runtime dependencies: the output runs anywhere
fetchis available. There is no runtime package to install and nothing to configure.
Example
npx oasis-gen openapi.yaml -o src/api.tsimport { createClient } from "./api.ts";
const api = createClient({ baseUrl: "https://api.example.com" });
const res = await api.GET("/pets/{petId}", { path: { petId: 1 } });
if (res.status === 200) {
res.data.name; // typed from the 200 response
} else if (res.status === 404) {
res.data.title; // typed from the 404 response
}Install
npm install --save-dev oasis-genThe CLI and the generated client need Node.js 22 or later. The client also
runs in browsers (tested in Chromium, Firefox, and WebKit) and Bun, and
type-checks with TypeScript 5.0 or later. Generate only from documents you
trust: oasis-gen reads any local file that a $ref points to.
The package ships prebuilt binaries for macOS, Linux, and Windows, on arm64 and x64. npm installs only the one for your platform. Archives are also attached to each GitHub release. To build from source instead:
cargo install --git https://github.com/22mb/oasisDocumentation
- Getting started: from an OpenAPI document to a typed API call
- Strict types: the rules that the generated types follow
- Calling operations, Middleware, and Authentication
- Recipes: common tasks and troubleshooting
- CLI and API, Schemas, and OpenAPI support
Changes in each release are listed in CHANGELOG.md.
Contributing
See CONTRIBUTING.md for the development setup and the design of the generator.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
