swift-openapi-generator icon indicating copy to clipboard operation
swift-openapi-generator copied to clipboard

Support deepObject style for query params

Open czechboy0 opened this issue 2 years ago • 11 comments

Support deepObject style for query params.

Used by the Stripe API, for example.

czechboy0 avatar Sep 09 '23 11:09 czechboy0

Not just for query items, but also URL encoded bodies, once we support them.

czechboy0 avatar Sep 09 '23 11:09 czechboy0

I just encountered this issue and I'd love to see better support for query params, let me know if you need help with it. :)

tib avatar Oct 26 '23 07:10 tib

Yes support for at least deepObject is planned for 1.0, and it would be awesome if you could contribute it. I suspect most of the changes would be in the runtime library's URIEncoder and URIDecoder, please take a look there and see if adding deepObject support would be a project you want to take on. Note that while it's being improved, it might also make sense to just do https://github.com/apple/swift-openapi-generator/issues/258 as well, as the latter might be a natural extension of the existing logic. deepObject will be slightly more involved, but shouldn't be too difficult.

Take a look at how the encoder/decoder works today and see if you can extend it, and I'm here if you have any questions 🙂

czechboy0 avatar Oct 26 '23 07:10 czechboy0

I'll assign you to the issue for now, but don't feel obligated if you decide not to do it, just let me know and I'll unassign it. It's to avoid multiple people working on the same issue 🙂

czechboy0 avatar Oct 26 '23 07:10 czechboy0

Cool, I'll think about this, but can't promise anything, if I have time I can definitely implement this, it'd be cool to eliminate the current workaround from my sample project. 😅

tib avatar Oct 26 '23 08:10 tib

A related ask for this: https://github.com/apple/swift-openapi-generator/issues/292

czechboy0 avatar Oct 26 '23 08:10 czechboy0

Ok just let us know if you start working on this @tib, but no pressure. I unassigned it for now to leave it available for others to pick up.

czechboy0 avatar Oct 27 '23 14:10 czechboy0

Hi @czechboy0, I encountered the same issue so I took the initiative to address it. Excited to hear your thoughts when you get a chance to check my PRs out. Cheers! 🚀

  • https://github.com/apple/swift-openapi-runtime/pull/100
  • https://github.com/apple/swift-openapi-generator/pull/538

kstefanou52 avatar Mar 07 '24 13:03 kstefanou52

Hi @kstefanou52 - sure I just came back from vacation, let me take a look shortly.

czechboy0 avatar Mar 11 '24 07:03 czechboy0

Runtime changes landed in swift-openapi-runtime 1.4.0.

czechboy0 avatar Apr 16 '24 09:04 czechboy0