[dart-dio] fix issue with multi layered discriminators#16136
Closed
fstotz wants to merge 10 commits into
Closed
Conversation
Author
|
Hi is there anything I still need to do so that it can be merged? |
Contributor
|
@felixmede hi, sorry for not noticing this until now, I will check it |
added 3 commits
August 30, 2023 10:07
…Value to return the parent instead
…i_layered_discriminators
Contributor
|
@felixmede is it possible to also fix this #15517 |
Contributor
|
@wing328 can you run ci please ? |
Member
I guess so. Not sure how that file is used |
added 3 commits
September 25, 2023 12:28
… into dart-dio_fix_multi_layered_discriminators
Author
This is also fixed now |
added 2 commits
October 2, 2023 11:06
ahmednfwela
reviewed
Oct 2, 2023
Comment on lines
+190
to
+198
|
|
||
| @Override | ||
| public String toString() { | ||
| final StringBuffer sb = new StringBuffer("MappedModel{"); | ||
| sb.append("mappingName='").append(mappingName).append('\''); | ||
| sb.append(", modelName='").append(modelName).append('\''); | ||
| sb.append('}'); | ||
| return sb.toString(); | ||
| } |
Contributor
There was a problem hiding this comment.
@wing328 is this change appropriate for the core generator ?
Author
|
Is there anything left to do from my side? |
Author
Contributor
|
while I can't give a proper review due to not having proper tests, I think it looks ok |
Author
|
addressed in #23717 |
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.
fix for issue issue #15467
When using the dart-dio generator to generate an API with an specs file, which uses multilayered classes with a discriminator at the lowest layer with an discriminator, the generated code tries to map all the values in the middle layer class to all of the subclasses of the lowest layer class.
e.g. classes animal, bird, reptile, turtle, crocodile
The generator runs without an error but there are issues inside of the generated code.
The discriminator mapping inside of the animal class is working fine but the one at reptile uses the same as the one at the animal. This creates a bird and then return it as a bird. This is not allowed in this place because bird is not a subtype of reptile. Since this is a compile error, created by parts of code, which will never be executed, any app using the library is unable is unable to be started.
https://gist.github.com/felixmede/058272bdad39fa14ee30f03e65dbd1df
@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)
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)