Open wouterkroes opened 4 weeks ago
@wouterkroes if you want to investigate and provide a PR that would be great!
@melloware I gave it a try, https://github.com/anymaniax/orval/pull/1361, what do you think?
I think this is by design. We only make optional those params that are used to enable/disable the query, like here: https://github.com/anymaniax/orval/blob/master/samples/react-query/custom-client/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts#L253
The query can't be enabled without those params, because they are path params (they go into URL like /v${version}/pets/${petId}
For us it doesn't make sense to be passing null or undefined values in there, so this is the reason for this feature to exist.
To fix this issue you can rename allParamsOptional
to allPathParamsOptional
and/or update documentation.
For other stuff it doesn't make sense to make them optional. Your swagger schema should define which properties are required, and which are optional. If it doesn't match reality - fix the BE to generate correct schema for your FE.
If you really need it - please create a separate flag, because this one isn't it.
Hopefully I remembered everything correctly, but feel free to double check.
Hope this helps, cheers!
What are the steps to reproduce this issue?
What happens?
Not all params are optional.
What were you expecting to happen?
All params are optional.
Any logs, error output, etc?
No
Any other comments?
Generated output
My guess is that params of type Object (and Array?) are not handled correctly.
What versions are you using?
Operating System: Windows
Package Version: 6.27.1
Browser Version: n/a