Spec compatibility
What typeship accepts: Swagger 2.0, OpenAPI 3.0 and 3.1, and GraphQL, and how each construct maps to the generated packages.
typeship accepts Swagger 2.0, OpenAPI 3.0.x, and OpenAPI 3.1.x as JSON or YAML, up to 10MB, plus GraphQL schemas as SDL, introspection JSON, or an introspectable endpoint URL. The rule throughout: generation fails only for a document that is not a spec at all. Everything else generates, and anything skipped or approximated is reported as a warning on the result.
Swagger 2.0
2.0 documents are normalized to OpenAPI 3.0 before generation. The converter covers the constructs that appear in real specs:
host,basePath, andschemesbecome the server URL. https is preferred when listed.definitionsbecomecomponents.schemas.$refpointers are rewritten to their 3.0 locations.bodyparameters become request bodies.formDataparameters become a form-encoded body, or multipart when there are file uploads.consumesandproducesbecome content types on request and response bodies.securityDefinitionsbecome security schemes. Basic, apiKey, and oauth2 are mapped. Unsupported types are skipped with a warning.
Known limitation: shared parameters in the top-level parameters section that are body or formData parameters cannot be converted in place and are skipped with a warning. Inline them in each operation for full fidelity.
References
Only local references (#/components/...) are resolved. External references to other files or URLs are not fetched. The referenced schema becomes unknown and a warning is reported. Dangling local references are treated the same way. Bundle multi-file specs into one document before generating.
GET and HEAD request bodies
Request bodies declared on GET or HEAD operations are dropped, with a warning listing the affected operations. Intermediaries do not reliably transmit GET bodies, so the SDK refuses to expose them.
Server URLs
- The first entry in
serversbecomes the client's default base URL. Server variables are substituted with their declared defaults. - Two or more servers export named environments, taken from each server's description.
- A relative server URL (
/v1) or a variable without a default cannot produce a usable base URL. The client is still generated, but the base URL becomes a required constructor option and a warning says so.
Authentication
| Scheme in the spec | Client option |
|---|---|
| HTTP bearer | bearerToken |
| HTTP basic | basicAuth |
| API key in a header or query | apiKey, or one option per key when there are several |
| OAuth2 and OpenID Connect | bearerToken for a token you obtained elsewhere, plus clientCredentials for the client credentials grant against the spec's token URL |
| Cookie parameters | Dropped |
| Anything else | Warning, no option |
When OAuth2 is declared, the generated CLI also gains a device-flow login once a client id is configured. See login, logout, whoami.
Webhooks
The webhooks section (3.1) and the x-webhooks convention (3.0) generate typed events and a verifying parser. Each webhook needs a JSON request body schema. See Webhooks.
Bodies and responses
| Content type | Generated as |
|---|---|
application/json | Typed body, JSON encoded |
application/x-www-form-urlencoded | Typed body, deep bracket encoded |
multipart/form-data | SDK-only. Not in the CLI, MCP server, Python, or Go. |
| Binary bodies | SDK-only. Same exclusions. |
text/event-stream responses | A stream. SDK-only. |
Other text/* responses | A string |
| Other responses | Raw bytes |
Pagination
Four styles are detected from parameter and response names. When detection guesses wrong, pin the rule per operation. See Pagination and Pagination rules.
GraphQL
GraphQL schemas generate the same TypeScript package as OpenAPI specs, on the same runtime. Queries become methods on client.query, mutations on client.mutation. Object types carry an optional __typename literal. Unions, and interfaces with implementers, become a union of their concrete types, discriminated by __typename. Subscriptions are skipped with a warning. Custom scalars map to unknown. Operation documents are not an input. The endpoint and auth scheme, which a schema cannot declare, come from config and default to the URL the schema was fetched from and a bearer token. See Generate from GraphQL.
When generation fails
Hard failures are reserved for documents that are not a spec at all: empty input, unparseable JSON or YAML, a top level that is not an object, no openapi or swagger field, an unsupported version, no paths, no Query or Mutation fields, or more than 10MB. Errors and warnings lists every message with what to do about it.
MCP server
Let a coding agent drive typeship: generate packages, create and configure projects, trigger regeneration, and read results, all as tools. Hosted at typeship.dev/mcp, or local from the typeship package.
Errors and warnings
Every message the generator can produce, quoted verbatim, with what to do about it. Errors stop generation. Warnings never do.