Skip to content

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Apr 26, 2025

fixes #5133

@lahma lahma force-pushed the fix-parameter-default-explode branch from 52b114b to 5596ef2 Compare April 26, 2025 08:55
@lahma lahma force-pushed the fix-parameter-default-explode branch from 5596ef2 to 2b32baa Compare April 26, 2025 08:56
@lahma lahma merged commit 31c59ba into RicoSuter:master Apr 26, 2025
3 checks passed
@lahma lahma deleted the fix-parameter-default-explode branch April 26, 2025 09:08
@KirkMunroSagent
Copy link

KirkMunroSagent commented Apr 29, 2025

@RicoSuter This is a breaking change, and it is implemented incorrectly as well.

With this change, the nswag generator changes the way it generated a C# client from a swagger doc. I have endpoints with query parameters that are arrays, and before this change they would correctly generate as ?myArray=val1&myArray=val2&myArray=val3, but now they generate as ?myArray=val1,val2,val3. Per the documentation, "When style is form, the default value is true. For all other styles, the default value is false." If you then read on the Style property, the docs say "Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.", so, for query parameters the default style is form, which means the default value of explode should be true, as it was before, but with this PR merged in that has changed such that the default value is now false, breaking existing frameworks that use nswag for client library generation. Please have someone fix this breaking change so that query parameters work as they should per the documentation.

cc: @lahma

@lahma
Copy link
Collaborator Author

lahma commented Apr 30, 2025

Please have someone fix this breaking change so that query parameters work as they should per the documentation.

@KirkMunroSagent can you be the one? A PR with new test coverage showing the desired way of working.

@KirkMunroSagent
Copy link

Please have someone fix this breaking change so that query parameters work as they should per the documentation.

@KirkMunroSagent can you be the one? A PR with new test coverage showing the desired way of working.

I'm on vacation, so there's no likelihood that I'll have time for this anytime soon.

This PR is a breaking change and should be reverted. It goes against the documentation, so the simplest way to fix this issue that didn't exist before is to create another PR that reverts this set of changes and then leave it until someone can re-do them properly while respecting the documentation.

@NenadSteric
Copy link

we also ran into this issue.
current version of nswag (14.4.0.0) is not generating correct c# code for array parameters.

@KollarM
Copy link

KollarM commented May 9, 2025

Same here. The current version 14.4.0 is not generating correct c# code for array parameters.

@AFAde
Copy link

AFAde commented May 20, 2025

Hello,
I am experiencing the same error. Is a fix supposed to be released any time soon?

Thanks

@schauers
Copy link

Hello,
I am experiencing the same error. Is a fix supposed to be released any time soon?

Thanks

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.

Explode property for query parameter in C# code generator
6 participants