Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
46 stars 19 forks source link

polarity of `queryParamExplode` is backwards in `serializeQueryParam` #74

Closed stepcut closed 2 years ago

stepcut commented 2 years ago

I am pretty sure the polarity for queryParamExplode is inverted. This patch should fix it:

https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/commit/534b45874b6035779dda47af6e0081baacd7842c

If I understand the code correctly, it would seem that jsonToFormDataFlat generates the query parameters in the exploded form. So queryParamExplode should do nothing (aka, id) if the parameters are supposed to be exploded. And it needs to consolidate them if they are not supposed to be exploded.

I had issues calling the mailchimp marketing api until I fixed this polarity in the generated code. When I printed out the request, the query parameters were exploded when the should not have been.

joel-bach commented 2 years ago

Hey @stepcut, thank you for noticing, you are absolutely right!

I noticed while investigating that there are other flaws as well with the current implementation and I fixed them as well as added tests to make sure it should work in the future too in this commit. I will create a PR for it shortly and after merging close this issue if this is fine with you.

stepcut commented 2 years ago

Thanks! Sounds good to me.