Skip to content

OpenAPI support ​

This page lists what oasis-gen accepts from a document and what it does with each feature. The support levels mean the following:

  • Supported: the feature affects the generated client.
  • Ignored: the feature is accepted but does not affect the generated client.
  • Rejected: the feature stops generation with an error.
  • Not supported: the feature is handled only as noted, or not at all.

Versions ​

VersionSupport
OpenAPI 3.2Supported
OpenAPI 3.1Supported; treated exactly like 3.2
OpenAPI 3.0Supported, with the differences below
Swagger 2.0 (swagger: "2.0")Not supported

In an OpenAPI 3.0 document, these keywords are handled as follows:

KeywordHandling
nullable: trueAdds null to the type. On an enum, null is added even if the list omits it. Other generators read it this way, although under 3.0.3 itself such an enum still disallows null
nullable: true next to a $ref, or on an allOf with one $refAdds null to the referenced type
Other keywords next to a $refApplied, as in 3.1 and later, although 3.0 says to ignore them: { $ref: Base, properties: {...} } is Base & {...}
type: string, format: binaryRaw binary, read as a schema without a type: unknown, or Blob in a multipart body or a text/* response
type: string, format: byteBase64 text, read as contentEncoding: base64: a string, sent as an application/octet-stream multipart part
example, a boolean exclusiveMinimumIgnored

nullable in a 3.1 or 3.2 document is rejected, because those versions of the specification would silently ignore it. Use type: [..., "null"] instead.

Documents ​

FeatureSupportNotes
JSON and YAMLSupportedFrom a file, or from stdin with -
$refs to other local filesSupportedWhole documents or fragments, resolved relative to the referencing document
$self, and $id and $anchor in schemasSupportedA $self URI such as https://api.example.com/openapi/root.yaml is mapped onto the file's own directory, so schemas/pet.yaml next to it is found locally
components.mediaTypes and $refs to themSupported
Component names other than ASCII letters, digits, ., - and _RejectedThe specification limits them to ^[a-zA-Z0-9\.\-_]+$
Remote $refs, and URLs as inputNot supportedhttps://... URIs that do not map onto a local file

Schemas from other files get type aliases of their own, but only component schemas are exported and listed in components (see Schemas).

Generate only from documents you trust: oasis-gen reads any local file that a $ref points to, wherever it is.

Schemas ​

See Schemas for the TypeScript type that each keyword becomes.

FeatureSupportNotes
JSON Schema 2020-12Supportedtype arrays, const, enum, allOf, oneOf, anyOf, prefixItems, minItems, additionalProperties, patternProperties, propertyNames (as a list of names), $ref with sibling keywords, and readOnly and writeOnly (see Strict types)
Recursive schemasSupportedThrough properties, arrays, and additionalProperties, including $refs into $defs and other locations outside components.schemas
discriminator on oneOf or anyOfSupportedExplicit and implicit mappings, and defaultMapping
Subtypes listed in the parent's oneOf, each extending it with allOfSupportedSee Subtypes
Other cycles through $ref, allOf, oneOf or anyOf aloneRejectedCycles with no object or array in between
discriminator on an allOf parentNot supportedThe parent is not turned into a union of its children
$dynamicRefNot supportedTyped as unknown

Operations ​

FeatureSupportNotes
get, put, post, delete, options, head, patch, traceSupported
query (the HTTP QUERY method)Supported
additionalOperationsSupportedCustom methods such as LINK
Some additionalOperations namesRejecteddelete, get, head, options, post, and put regardless of case, and PATCH, TRACE, and QUERY in uppercase, because fetch would send them as the same methods as the fixed fields; also with and then, which the client reserves
Callbacks and webhooksNot supported

Parameters ​

LocationStylesNotes
queryform, deepObjectallowReserved is supported. spaceDelimited and pipeDelimited are rejected
pathsimplelabel and matrix are rejected
headersimple
cookieform (percent-encoded), cookie (sent as-is)Exploded values are joined with ; for both styles, because the specification rules out & for cookies
querystringSupportedTyped and encoded by its media type; see querystring parameters

Every style supports explode. Parameters with content instead of a schema are supported. A JSON query parameter is typed from its schema and serialized as JSON. Other parameters with content are passed as strings that are already serialized.

Cookie parameters and cookie API keys are sent as a Cookie header, which browsers ignore in fetch. They work in Node and Bun.

Request and response bodies ​

See Request bodies and Response bodies for how each media type is typed and decoded.

FeatureSupportNotes
Sequential media types and itemSchemaSupportedJSON Lines, NDJSON, JSON text sequences, and server-sent events, streamed as async iterables
multipart/form-data request bodiesSupportedTyped by the schema and sent as FormData; see Form bodies
Other multipart request bodies, such as multipart/mixedNot supportedPassed as a Blob the caller builds, whose type gives the media type with its boundary
Encoding Object (encoding)SupportedcontentType, style, explode, and allowReserved. FormData cannot send part headers or nested parts, so optional headers are left out, and a required header or a multipart part is rejected
prefixEncoding, itemEncodingNot supportedThey apply only to other multipart media types
Typed response headersNot supported

Servers and security ​

FeatureSupportNotes
servers at the top level, on path items, and on operationsSupportedVariables are set to their defaults; see Servers and baseUrl
Security schemesSupportedapiKey, http, oauth2, openIdConnect, and mutualTLS, through auth
OAuth2 flowsNot supportedYou obtain tokens yourself