Skip to content

Add OpenAPI 3.2 support - #158

Merged
pjmolina merged 1 commit into
metadevpro:masterfrom
bookernath:feat/oas-3.2-types
Jun 1, 2026
Merged

pjmolina merged 1 commit into
metadevpro:masterfrom
bookernath:feat/oas-3.2-types

Conversation

@bookernath

Copy link
Copy Markdown

Adds OAS 3.2 as a new oas32 module alongside the existing 3.0/3.1 ones, with the same layout (model, builder, barrel, subpath export, d.ts shim). 3.0 and 3.1 are untouched.

3.2 didn't change the JSON Schema dialect (still 2020-12), so it's mostly new document-level fields: streaming itemSchema/itemEncoding/prefixEncoding, the mediaTypes components bucket, query and additionalOperations on path items, the querystring param location, XML nodeType, the OAuth device flow, $self, and so on.

Couple of notes:

  • SchemaObject is typed a bit more completely than the 3.1 one (boolean schemas, the 2020-12 unevaluated* keywords). Same dialect, just filling gaps.
  • I included a few fields that were already valid in 3.1 but missing from the 3.1 model (jsonSchemaDialect, Info.summary, mutualTLS) so the 3.2 types are complete. Can split those into a separate 3.1 PR if you'd rather keep this scoped.

Closes #157.
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.2.0.md

@RobinTail

Copy link
Copy Markdown
Contributor

the querystring param location

🙏🏽

}

private static isValidOpenApiVersion(v: string): boolean {
v = v || '';

@RobinTail RobinTail Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps redundant statement, since v: string

@pjmolina pjmolina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@pjmolina
pjmolina merged commit b2574cd into metadevpro:master Jun 1, 2026
4 checks passed
@biolauri biolauri mentioned this pull request Jun 1, 2026
3 of 4 tasks
bookernath added a commit to bookernath/zod-to-openapi that referenced this pull request Jun 25, 2026
3.2 keeps the 3.1 JSON Schema dialect (2020-12), so OpenApiGeneratorV32
reuses the 3.1 specifics and only adds the new document-structure fields:

- itemSchema on media types (text/event-stream, application/jsonl, ...),
  converted and registered like schema when given a Zod type
- itemEncoding / prefixEncoding on media types
- optional response description + summary
- query HTTP method on routes

Requires openapi3-ts with the oas32 module (metadevpro/openapi3-ts#158).

The lazy transformer cast is needed because openapi3-ts >= 4.2 added an
optional $ref to SchemaObject, so 'in' no longer narrows the union.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support OAS 3.2

3 participants