fix(core): support tuple validation when schema items is an array (JSON Schema draft 07)#34636
fix(core): support tuple validation when schema items is an array (JSON Schema draft 07)#34636
items is an array (JSON Schema draft 07)#34636Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
items is an array (JSON Schema draft 07)
|
View your CI Pipeline Execution ↗ for commit 41caeeb
☁️ Nx Cloud last updated this comment at |
|
I would like to see tests that check these values:
|
@copilot |
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
Added all three test cases in 890177f, along with the actual
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Copilot <Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
Our e2e-web test encountered an infrastructure failure where the local npm registry at http://localhost:4873 is missing the @swc/jest package, causing a pnpm install failure. This is unrelated to the schema validation changes in this PR, which only modify params.ts validation logic. The test environment's registry needs to be restored before this e2e test can pass.
No code changes were suggested for this issue.
🔂 A CI rerun has been triggered by adding an empty commit to this branch.
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
Co-authored-by: Copilot <Copilot@users.noreply.github.com> [Self-Healing CI Rerun]
validatePropertyinparams.tsdid not handle the case whereitemsis an array — the JSON Schema draft 07 tuple validation form. This caused false validation failures for schemas like Angular's@angular/build:unit-test, which uses tupleitemsto type reporter configurations:{ "type": "array", "minItems": 1, "maxItems": 2, "items": [ { "anyOf": [{ "type": "string" }, { "enum": ["junit", "html", ...] }] }, { "type": "object" } ] }Options like
"reporters": [["junit", {"suiteName": "MyApp"}]]would incorrectly fail validation with "Property 'reporters' does not match the schema".Changes
validateProperty: whenschema.itemsis an array, validates each element against its positional schema instead of passing the whole array as a schemaminItems/maxItemsenforcement: array length is now validated againstminItemsandmaxItemsconstraints when presentadditionalItemssupport: rejects extra items whenadditionalItems: false; validates against theadditionalItemsschema when present; otherwise allows additional items (spec-compliant default)PropertyDescriptiontype: addedminItems,maxItems,additionalItemsfields; narroweditemsfromanytoPropertyDescription | PropertyDescription[]coerceTypeandgetPromptsForSchemawhereitems.enumwas accessed without accounting for the array formOriginal prompt
itemsis a list. #34631✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.