fix(typescript-angular): serialize Set query params as JSON arrays

TH
17h ago
+52-22

typescript-angular generates Set<T> for uniqueItems arrays, but json query params (content: application/json or queryParamObjectFormat=json) go through bare JSON.stringify in addToHttpParams, and JSON.stringify(new Set(['a', 'b'])) is {}, so request goes out with tags={}. #23442 fixed only the form branch

Json branch now uses a replacer that turns Set into an array, other values serialize byte for byte as before. Added uniqueItems tags param to 3_0/query-param-json.yaml and a Karma case to api.query_param_json.spec.ts in typescript-angular-v20 sample, it fails on master with tags=%7B%7D and passes with the fix

Ran ./bin/generate-samples.sh bin/configs/typescript-angular*.yaml, only api.base.service.ts changes by one line in each sample, plus the new param in query-param-json. ./mvnw clean package passes except Kotlin generator tests, those fail on JDK 25 on my machine (embeded Kotlin compiler)

Fixes #13500

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 serialization of Set query parameters in typescript-angular so JSON-style query params are sent as arrays instead of {}.

JSON.stringify now uses a replacer that converts Set instances to arrays; all other values serialize unchanged. Fixes #13500.