Repository navigation
Add OpenAPI 3.2 support - #158
Merged
Merged
Conversation
Contributor
🙏🏽 |
RobinTail
reviewed
Jun 1, 2026
| } | ||
|
|
||
| private static isValidOpenApiVersion(v: string): boolean { | ||
| v = v || ''; |
Contributor
There was a problem hiding this comment.
perhaps redundant statement, since v: string
RobinTail
approved these changes
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds OAS 3.2 as a new
oas32module 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, themediaTypescomponents bucket,queryandadditionalOperationson path items, thequerystringparam location, XMLnodeType, the OAuth device flow,$self, and so on.Couple of notes:
unevaluated*keywords). Same dialect, just filling gaps.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