这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@pixelmord
Copy link
Contributor

Fixes: #1804

Instead of just using one universal setting for array parameters in the serializer this introduces per field parameters to support uneven explode config.

Changes

Replaced global query serialization overrides with per-parameter configuration.

Before: Generated a single global querySerializer override that applied to all parameters,
breaking on the first array parameter needing custom serialization.

After: Generates parameter-specific serialization configs under
querySerializer.parameters[paramName], allowing different style and explode settings per query
parameter.

Implementation:

  • Added parameters field to QuerySerializerOptions for per-parameter overrides
  • Modified operation.ts to build serialization config for each parameter needing non-default
    settings (arrays not using form/explode=true, objects not using deepObject/explode=true)
  • Updated query serializer to check parameter-specific config before falling back to global
    settings
  • Now handles both array and object serialization overrides per parameter

…on overrides

Introduces a 'parameters' option to QuerySerializerOptions, allowing per-parameter overrides for array, object, and allowReserved settings in query serialization. Updates generated clients and tests to support and demonstrate this new capability.
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 780dbe9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 24, 2025
@vercel
Copy link

vercel bot commented Oct 24, 2025

@pixelmord is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added bug 🔥 Something isn't working client Client package related labels Oct 24, 2025
@mrlubos
Copy link
Member

mrlubos commented Oct 24, 2025

Hmm, why is the OpenAI example still causing issues... I ignored it here https://github.com/hey-api/openapi-ts/blob/main/eslint.config.js#L67 so I expect it to be in sync with main

@mrlubos
Copy link
Member

mrlubos commented Oct 24, 2025

@pixelmord Is your branch based on the latest from main? I updated the ESLint config yesterday I think, pull it locally and regenerate one more time if you're not on the latest

@mrlubos
Copy link
Member

mrlubos commented Oct 24, 2025

@pixelmord Did you investigate why that one parameter produces a custom config? I'm not clear where the "form" style comes from, the spec doesn't seem to be defining it and it's not the default for objects... otherwise the feature itself looks really good!

@pixelmord
Copy link
Contributor Author

@pixelmord Did you investigate why that one parameter produces a custom config? I'm not clear where the "form" style comes from, the spec doesn't seem to be defining it and it's not the default for objects... otherwise the feature itself looks really good!

@mrlubos not sure, I have to say I am not very familiar with the codebase, I was a bit flying blind. I just did a code search to find the spots where the querySerializer is constructed and and applied and changed that to a map for every field.
So please thoroughly review this with your experience!

@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.36%. Comparing base (0c00742) to head (780dbe9).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2837      +/-   ##
==========================================
- Coverage   30.39%   30.36%   -0.03%     
==========================================
  Files         485      485              
  Lines       39764    39803      +39     
  Branches     2413     2413              
==========================================
  Hits        12088    12088              
- Misses      27645    27684      +39     
  Partials       31       31              
Flag Coverage Δ
unittests 30.36% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos
Copy link
Member

mrlubos commented Oct 24, 2025

Sounds good, I'll take it from here!

@mrlubos
Copy link
Member

mrlubos commented Oct 25, 2025

Leaving this here for my own reference openapi-ts/openapi-typescript@2bbeb92#r168790715

@mrlubos mrlubos force-pushed the fix/querySerializer branch from f13d6c3 to f191079 Compare October 25, 2025 01:35
Updated the serialization strategy for query parameters to allow for more granular control.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 25, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/codegen-core@2837
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2837
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2837
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2837

commit: 780dbe9

@mrlubos mrlubos merged commit 3ad2c71 into hey-api:main Oct 25, 2025
14 of 16 checks passed
@hey-api hey-api bot mentioned this pull request Oct 25, 2025
@pixelmord
Copy link
Contributor Author

Thx very appreciated! @mrlubos

@mrlubos
Copy link
Member

mrlubos commented Oct 26, 2025

Thank YOU!

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

Labels

bug 🔥 Something isn't working client Client package related size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No support of per query field serialisation: only the last field's explode config is used

2 participants