[dart-dio] fix endpoints returning null#15433
Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom May 8, 2023
Merged
Conversation
agilob
approved these changes
May 6, 2023
Contributor
Author
kuhnroyal
reviewed
May 7, 2023
| {{#returnType}} | ||
|
|
||
| {{{returnType}}} _responseData; | ||
| {{{.}}}? _responseData; |
Contributor
There was a problem hiding this comment.
Don't we know if the response may be null? Maybe we can also change the operation generic return type?
Contributor
Author
There was a problem hiding this comment.
it won't matter since the final response.data is nullable anyway
Contributor
There was a problem hiding this comment.
True, that's a dio probelm.
kuhnroyal
approved these changes
May 7, 2023
|
@wing328 @ahmednfwela we should allow developers to define whether they want the response to be nullable or not, data being nullable adds lots of check for the null value. For some usecases, if the data is null, we may want to throw an exception. It should be customisable IMO. Your thoughts? |
Contributor
Author
|
having the response nullable suits all cases, and then devs can throw exceptions them selves if the response is null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modify mustache files to handle cases where the response data is null (e.g. status code 204) instead of throwing an exception
fixes #15426
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(6.3.0) (minor release - breaking changes with fallbacks),7.0.x(breaking changes without fallbacks)@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)