-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REQ] typescript-axios useSingleRequestParameter should mark parameter optional if all properties are optional #6440
Comments
@benwiley4000 good suggestion, would you like to implement this? |
@macjohnny perhaps, if you can point me to where I would need to look in the code. |
should be somewhere here: openapi-generator/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache Lines 295 to 319 in bde0d77
the openapi-generator/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache Line 297 in bde0d77
part should already prevent generation of an interface if no parameters are available, but somehow this doesn't work. maybe @codeserk can help, as he implemented this feature in #6288 |
@benwiley4000 I think this is the right line to check in openapi-generator/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache Line 354 in bde0d77
We should add I can take a look a bit later :) |
Follow-up to #6288.
Is your feature request related to a problem? Please describe.
If the
useSingleRequestParameter
flag is passed to typescript axios, then an object is a required parameter of all request functions, even if all object properties are optional, so I end up with code like this:myApiCall({})
.Describe the solution you'd like
The generator should be able to check if any of the params are required. If not, we can specify the whole object parameter optional with
?
.Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: