-
-
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
[dart-dio] fix issue with multi layered discriminators #16136
base: master
Are you sure you want to change the base?
[dart-dio] fix issue with multi layered discriminators #16136
Conversation
Hi is there anything I still need to do so that it can be merged? |
@felixmede hi, sorry for not noticing this until now, I will check it |
…Value to return the parent instead
…i_layered_discriminators
@felixmede is it possible to also fix this #15517 |
@wing328 can you run ci please ? |
I guess so. Not sure how that file is used |
… into dart-dio_fix_multi_layered_discriminators
This is also fixed now |
|
||
@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(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 is this change appropriate for the core generator ?
Is there anything left to do from my side? |
while I can't give a proper review due to not having proper tests, I think it looks ok |
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)