-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Add support for multiple inheritance #1664
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
Conversation
Thanks for opening this issue! I have applied any relevant labels. |
Didn't we already have |
@cbornet yup, only JS client generator uses that. My current approach is to keep the "supportsMixin" and add new code, mustache tags to support mutiple inheritnance for other langauges as part of the code cleanup/refactoring. |
I mean, can't we reuse this option for other languages ? |
Very good question. Ideally we should extend or reuse Lines 1652 to 1655 in 158760a
I couldn't understand why only the first model is considered in mixin (multiple inheritance) - shoudn't it consider all models defined in |
Actually with your modifications |
Also I prefer "mixin" over "multiple inheritance" as it better describe what is done. Multiple inheritance is bad and should be avoided at all cost while mixins are ok. |
OK. I'll keep the |
👍 I wonder what's the effect of the modifications on the JS codegen ? I guess the mixin/multiple-inheritance shall be activated for this one. |
I've updated the JS samples and the tests passed. No visible code change which is expected as I try not to break backward compatibility at the moment. |
Also I don't think we have multiple inheritance in samples |
@cbornet yup, I added several spec to test allOf, multiple inheritance, etc (e.g. allOfMultiParent.yaml). We'll add those to the fake petstore spec when more generators are ready for these new features. We'll test with these new spec individually for the time being. |
* add all parent names * clean up supportsInheritance * fix npe * fix allVars, fix test cases * add more tests, remove comments * update docker m2 cache dir, add more tests, fix mandatory * update samples * regenerate js spec files * add logic to detect self reference * add isSelfReference flag to codegen property * add ruby tests for cat model * remove debugging info * fix JS allvars not have x-js-doctype * update samples * update js samples
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,. Default:3.4.x
,4.0.x
master
.Description of the PR
allParents
tagallVars
,vars
allRequired
mandatory
,allMandatory
isSelfReference
flag to codegen propertyrun-in-docker.sh
to use the local Maven cachecc @OpenAPITools/generator-core-team