fix(typescript-fetch): send query params with JSON content as JSON

Merged
TH
2d ago
+90-3

Query param with content: application/json from #13222 is sent like plain one: object goes through querystring as filter[duration_min]=1, array is joined with commas. ExtendedCodegenParameter didnt even copy queryIsJsonMimeType, headers got same thing in #25088

Now such param is sent as JSON.stringify of value. Param that refs generated model goes through its ToJSON first (not with withoutRuntimeChecks, same as request body), sets through Array.from. Added test in TypeScriptFetchClientCodegenTest, generated clients compile with tsc 6 strict in both modes, regenerated typescript-fetch samples: no changes

Fixes #13222

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    Commit all changed files.
  • 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 sending query parameters with application/json content as JSON instead of plain form encoding in the typescript-fetch client. Previously objects were stringified through querystring (e.g. filter[duration_min]=1) and arrays were comma-joined; now the value is passed through JSON.stringify, using the model's ToJSON when available and Array.from for unique item sets. Adds tests and regenerates samples with no output changes. Fixes #13222.