fix(openapi-typescript): allOf composition to use required from subschemas - #2858
Open
split wants to merge 1 commit into
Open
fix(openapi-typescript): allOf composition to use required from subschemas#2858split wants to merge 1 commit into
split wants to merge 1 commit into
Conversation
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: 5e66ebe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Fix allOf composition to apply required properties from $ref-resolved subschemas and omit empty members that produced meaningless & unknown intersections.
split
force-pushed
the
fix-allof-required-composition
branch
from
September 4, 2026 14:09
f363a53 to
5e66ebe
Compare
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.
This is my first contribution attempt to the project, so let's start with a big thank you. This project has greatly helped us maintain trust between changes in our internal services that share the same monorepo, while getting rid of the runtime ties.
During that transition, we noticed that some of our service specs couldn't be turned into usable types, and it was often related to
allOfusage. This MR is an attempt to make those resulting types reflect the spec more closely.Changes
allOfcomposition to apply required properties from$ref-resolved subschemas.& unknownintersections.This continues the work done for the #657 and fixes most of the
allOfrequired intersection issues that were mentioned in the comments.How to Review
Added a bunch of unit tests that should cover most of the cases. Examples also show quite nicely real-life use cases that were broken, but now produce meaningful
WithRequiredtypes.Couple examples:
Following schema in
examples/digital-ocean-api/shared/meta.ymlwill now produce:
Similar way the different versions of the
domain_recordnow make more sense:During this I noticed that the discriminators will mutate the schema, causing the snapshot updating to fail in interactive mode. I can open a separate MR to remedy that issue.
Checklist
docs/updated (if necessary)pnpm run update:examplesrun (only applicable for openapi-typescript)