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

Support optional singleRequestParameter

Open angelaki opened this issue 1 year ago • 2 comments

Fixes https://github.com/OpenAPITools/openapi-generator/issues/18456. Add optional chaining to singleRequestParameter, if all parameters are optional.

angelaki avatar Apr 23 '24 10:04 angelaki

https://github.com/OpenAPITools/openapi-generator/actions/runs/8798721887/job/24147516590?pr=18467 already fixed in the master

cc TypeScript technical committee for review

@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04)

wing328 avatar Apr 24 '24 06:04 wing328

https://github.com/OpenAPITools/openapi-generator/actions/runs/8798721887/job/24147516590?pr=18467 already fixed in the master

wing328 avatar Apr 30 '24 07:04 wing328

Woohoo 🥳 Deployment estimations? Or: when will it hit https://hub.docker.com/r/openapitools/openapi-generator-cli? Doesn't seam to be part of 7.6.0-Snapshot, yet.

angelaki avatar May 06 '24 09:05 angelaki

Woohoo 🥳 Deployment estimations? Or: when will it hit https://hub.docker.com/r/openapitools/openapi-generator-cli? Doesn't seam to be part of 7.6.0-Snapshot, yet.

i think it should soon be part of the snapshot

macjohnny avatar May 06 '24 11:05 macjohnny

Woohoo 🥳 Deployment estimations? Or: when will it hit https://hub.docker.com/r/openapitools/openapi-generator-cli? Doesn't seam to be part of 7.6.0-Snapshot, yet.

i think it should soon be part of the snapshot

What kind of soon are you talking about? Minutes? Hours? Days? Thank you! :)

angelaki avatar May 06 '24 12:05 angelaki

https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.6.0-SNAPSHOT/

macjohnny avatar May 06 '24 12:05 macjohnny

So... Shouldn't it be part of the image, yet?

Edit: oh my ... was just my compose file not pulling the latest latest version ... everythings fine, ty!

angelaki avatar May 06 '24 13:05 angelaki

Hi @angelaki, your change doesn't make any sense, because CodegenModel hasRequiredVars is never actually initialized. It's always false. Since your changes, all my singleRequestParameter are generated as optional parameter, even though they do actually have required parameters...

There is another property hasRequiredParams, which might be what you were looking for - at least it works for me. Could you test if that solves your original issue?

xfh avatar Jul 17 '24 16:07 xfh

Haha... yes, that explains a lot. I lately noticed that all arguments are optional now (what imho is still better than the old behavior, where I had to but an empty object with thousant of call that don't have any mandatory parameters) and wanted to check it these days.

@wing328 did that change and recommended to use that value, maybe ask him?

angelaki avatar Jul 18 '24 13:07 angelaki