Repository navigation
openapi3: emit minItems/maxItems on tuple types - #12165
Open
Adam Hooper (ddadamhooper) wants to merge 1 commit into
Open
Adam Hooper (ddadamhooper) wants to merge 1 commit into
Adam Hooper (ddadamhooper) wants to merge 1 commit into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Adam Hooper (ddadamhooper)
October 13, 2026 17:49
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Valid empty tuples lack coverage ensuring zero-valued bounds are preserved.
1 open finding
What changed in this PR
Fixes OpenAPI tuple schemas to enforce exact tuple lengths.
Changes:
- Emits matching
minItemsandmaxItemsfor tuples. - Updates OpenAPI 3.0–3.2 tuple expectations.
- Adds an
@typespec/openapi3fix changelog.
| File | Description |
|---|---|
packages/openapi3/src/schema-emitter.ts |
Adds fixed lengths for OpenAPI 3.0 tuples. |
packages/openapi3/src/schema-emitter-3-1.ts |
Adds fixed lengths for OpenAPI 3.1/3.2 tuples. |
packages/openapi3/test/array.test.ts |
Updates tuple schema assertions. |
.chronus/changes/tuple-openapi3-fixed-length-2026-8-9-13-1-9.md |
Records the bug fix. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+848
to
+849
| const size = tuple.values.length; | ||
| return { type: "array", items: {}, minItems: size, maxItems: size }; |
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
This branch has not been deployed
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.

TL;DR #11893 for OpenAPI3
JSONSchema
prefixItemsdoesn't constrain the length of an array. But tuple types do.This PR changes the OpenAPI3 generator so generated JSONSchema won't accept 1-element or 3-element arrays.