feat: add version-specific OpenAPI compilers#7
Closed
DerManoMann wants to merge 3 commits into
Closed
Conversation
fc8def8 to
959ec2b
Compare
Introduce CompilerInterface and three implementations that transform a Specification into a versioned OpenAPI document array: - OpenApi31Compiler — base implementation (JSON Schema 2020-12) - OpenApi30Compiler — extends 3.1, overrides for draft-04 subset (nullable, exclusive min/max as booleans, no webhooks, no $ref siblings) - OpenApi32Compiler — extends 3.1, adds Tag summary/parent/kind and PathItem query Each compiler provides both compile() and validate() methods, keeping version-specific logic isolated from the rest of the pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
959ec2b to
798f50f
Compare
Owner
Author
|
Moved to zircote#2058 (base branch updated to master now that spec-dto is merged) |
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.
Summary
Introduces
CompilerInterfaceand three version-specific implementations that transform aSpecificationinto an OpenAPI document array. This is the compilation stage of the spec pipeline:Specification → Compiler → OpenAPI document (array)
Depends on zircote#2054.
Design
Version-aware compilers
Each OpenAPI version (3.0, 3.1, 3.2) has its own compiler that handles version-specific differences rather than branching inside a single serializer.
OpenApi31Compiler— base implementation (JSON Schema 2020-12, full 3.1 feature set)OpenApi30Compiler— extends 3.1, overrides for the draft-04 JSON Schema subset:typeis always a string (not array)nullableas separate boolean keywordexclusiveMinimum/exclusiveMaximumare booleans (alongsideminimum/maximum)$refsiblings (summary/description stripped)const, noexamplesarray (only singularexample)identifierfield (onlyurl)OpenApi32Compiler— extends 3.1, adds Tagsummary/parent/kindand PathItemqueryCompilerInterface