Fix prefixItems / minItems / maxItems tuple generation (#2053)#2148
Fix prefixItems / minItems / maxItems tuple generation (#2053)#2148duncanbeevers wants to merge 1 commit intoopenapi-ts:mainfrom
Conversation
❌ Deploy Preview for openapi-ts failed.
|
🦋 Changeset detectedLatest commit: 8a09dea 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 |
3285052 to
8a09dea
Compare
* Simplify minItems / maxItems tuple generation Closes openapi-ts#2048
8a09dea to
b6d6fcb
Compare
|
@drwpow you have looked at the 8.x equivalent of this. Do you also want to take this one, or shall I give it a stab to review? |
|
This PR looks good to me! Sorry, minor conflict in the PR, but with that resolved + changeset this is good to merge! No notes 🙂 |
|
Going to close this PR to clean things up. It was approved in May 2025 but was never merged, and now has too many conflicts to resolve cleanly. The more recent PR #2546 seems to accomplish the same things for the most part, but doesn’t have conflicts and is passing. Is there a way we can merge approved PRs quicker in the future? I know many PRs suffer from non-reviews, but we should work to merge & release approved PRs better if we can. |
🗣️ Discussion
This PR is an extraction of some work that has already landed in the 8.x branch. This is my first step in porting those changes to the 7.x branch.
Closes #2048
Changes
minItems/maxItemstuple generationArray.prototype.filter(Boolean)patternitems: false; prefixItems: …schemas; treatprefixItemsas explicit tuple value.items: […schemas], treatingitemsas explicit tuple value.How to Review
--experimental-array-spread-membersflagopenapi-tstypests-resetbehaviors should not be active in plain repo withopenapi-tsdependencyopenapi-tsfor programmatic use shouldn't start allowingts-resetbehaviors.ts-resettypes don't affect generated typesopenapi-typescript-generated types shouldn't start allowingts-resetbehavior.🔧 Backwards-compatibility
In order to get a sense for the backwards-compatibility of this PR I pulled the full suite of tests from
array.test.tsand ran them inmain. Test outputMany test cases in this corpus cover behavior not-yet-tested in
main, so this gives us a better sense of what will actually change.Many of the new tests (expectedly) failed in this older context, and the errors fell into four categories.
--experimental-array-spread-membersflag.immutable: trueis setimmutable: trueis set--array-lengthwithminItems: 1generates empty array #2048 problem)Checklist
docs/updated (if necessary)pnpm run update:examplesrun (only applicable for openapi-typescript)