fix(typescript-fetch): convert models inside nested arrays and maps #25672
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 427 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25672"
general
weight: 0.35
thekhegay
Core marks a container whose items are containers again as primitive (
Array/Mapbase type is language primitive), so model template copies such property as is. For map of arrays of models (this issue), and same for array of arrays, array of maps and map of maps,FromJSONreturns raw json: nestedDatestays string, andToJSONdoes not drop readOnly fieldsTypeScriptFetchClientCodegennow builds conversion for such properties when innermost items are models and puts it intox-nestedFromJson/x-nestedToJson, e.g.mapValues(json['x'], (v0: any) => (v0 as Array<any>).map(BarFromJSON)). Template uses them with same null/undefined gaurds as existing array branch. Nested containers of primitives, enums, free-form objects or with uniqueItems keep current outputAdded test in
TypeScriptFetchClientCodegenTestfor all four shapes, it fails on master. Sample changes:ArrayTest.arrayArrayOfModelin 3 typescript-fetch builds (default-v3.0, kebab-case, snakecase-discriminator), other 90 typescript configs unchanged. Typescript tests pass. Generated client for the test spec passestsc --strict, ran it under node: nestedwhenisDateafterFromJSONand ISO string afterToJSONFixes #21730
PR checklist
Commit all changed files.
@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes #21730 by generating explicit
FromJSON/ToJSONconversions for models nested inside arrays and maps in thetypescript-fetchclient.Previously, nested containers of models were copied as-is, so
FromJSONreturned raw JSON (e.g.Datevalues stayed strings) andToJSONkept readOnly fields. Now the generator detects when the innermost items are models and emits level-by-level conversion usingmapandmapValues, preserving null/undefined inner containers along the way. Nested containers of primitives, enums, free-form objects, or withuniqueItemskeep the current output.<sup>Written for commit 207ff8abba5ba7856bd06a23e2f7612cb16f0a5e. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25672?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->