fix(typescript-fetch): convert model items of array alias models
With generateAliasAsModel array alias model (CarList = Array<Car>) has no vars, so CarListFromJSONTyped and CarListToJSONTyped just return json and items are not converted, Date fields of Car stay strings. API methods and properties that use CarList go through these functions too
Now for array alias with model items both functions map items through CarFromJSON / CarToJSON, same expression as for array properties. Arrays of primitives and map aliases stay as before. Checked generated client with tsc 6 --strict and at runtime: builtAt becomes Date, null passes through. Added test in TypeScriptFetchClientCodegenTest, no typescript-fetch config uses generateAliasAsModel so samples dont change
Fixes #17533
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
Commit all changed files../mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka @joscha @KannaKim
Summary by cubic
Fixes #17533: with generateAliasAsModel enabled, array alias models like CarList = Array<Car> now convert their model items in FromJSONTyped/ToJSONTyped, so Date fields are properly parsed instead of remaining strings.
- Generated functions map items through the item model's
FromJSON/ToJSON. - Primitive and map aliases still return the value unchanged.
- Added a regression test using a minimal spec.