-
-
Notifications
You must be signed in to change notification settings - Fork 268
Fix path parameter serialization with flat params structure #2985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
When using paramsStructure: 'flat' with the SDK plugin, path parameters were being incorrectly serialized. The issue was that buildClientParams was treating the flat parameters object as a positional argument instead of iterating over its properties. Fixed by wrapping field configs in an args array when paramsStructure is 'flat', which tells buildClientParams to iterate over the flattened object properties instead of treating the entire object as a single positional argument. Co-authored-by: mrlubos <[email protected]>
Tested it by replacing my function with this. Works good. |
|
Can we trigger a test build with pkg-pr-new bot? @mrlubos |
Path parameters were incorrectly serialized when using
paramsStructure: 'flat'in the SDK plugin. A call likegetServer({ id: '123' })would generate URL/servers/id,123instead of/servers/123.Root Cause
The code generator was passing field configs directly to
buildClientParams:This caused
buildClientParamsto treat the entireparametersobject as a positional argument instead of iterating over its properties.Changes
Modified
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts:plugin.config.paramsStructure === 'flat'argsarray to signal object iteration modeGenerated code now correctly wraps fields:
This tells
buildClientParamsto iterate overparametersproperties and extract individual values, producing correct path parameter serialization.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.