Skip to content

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

Open
thekhegay wants to merge 1 commit into
OpenAPITools:masterfrom
thekhegay:fix/ts-angular-set-json-query
Open

thekhegay wants to merge 1 commit into
OpenAPITools:masterfrom
thekhegay:fix/ts-angular-set-json-query

Conversation

@thekhegay

@thekhegay thekhegay commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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.

Written for commit 77f6291. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 21 files

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][typescript-angular] UniqueItems and queryParamObjectFormat=json are incompatible

1 participant