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
[All] Add a supportsMixin property to codegens #3636
currently if supportsInheritance is true, the properties from parent and interfaces will not be included in vars.
currently if supportsInheritance is true, the properties from self, parent and interfaces will all be included in allVars.
this works well for Javascript because it uses some "mixin" import mecanism
this should also work well for languages that support mixins/multi-inheritance (python, ruby, C++, ...)
but it doesn't work well with Java because it doesn't support mixins/multi-inheritance (java interfaces can't be used because jackson and gson need POJOs/javaBeans).
The consequence is that since we don't have the interface properties in vars, we have to duplicate the code everywhere in the template to include both vars and interfaceModels.allVars
This could be mitigated by putting some parts of the code in imported templates but that would also make the template much harder to read.
So my idea is to add a supportsMixin property for languages that can use it (eg. Javascript)
Apologies for the delay in responding – have been swamped both at work and at home.
For the first bullet I think you meant “currently if supportsInheritance is false, the properties from parent and interfaces will not be included in vars.”
I see what you mean in the Java case. It is true that Mustache templates, being logic-less, require all business logic to be implemented by the caller. If you’re confident that your change can address the requirements of JavaScript, Java and other languages whilst preserving or rectifying existing (mis-)behaviour as appropriate then I wish you good luck with the PR.
currently if supportsInheritance is true, the properties from parent and interfaces will not be included in vars.
currently if supportsInheritance is true, the properties from self, parent and interfaces will all be included in allVars/
this works well for Javascript because it uses some "mixin" import mecanism
this should also work well for languages that support mixins/multi-inheritance (python, ruby, C++, ...)
but it doesn't work well with Java because it doesn't support mixins/multi-inheritance (java interfaces can't be used because jackson and gson need POJOs/javaBeans).
The consequence is that since we don't have the interface properties in vars, we have to duplicate the code everywhere in the template to include both vars and interfaceModels.allVars
This could be mitigated by putting some parts of the code in imported templates but that would also make the template much harder to read.
So my idea is to add a supportsMixin property for languages that can use it (eg. Javascript)
Activity
fix some inheritance/composition issues and add allOf unit tests
demonfiddler commentedon Aug 30, 2016
Apologies for the delay in responding – have been swamped both at work and at home.
For the first bullet I think you meant “currently if supportsInheritance is false, the properties from parent and interfaces will not be included in vars.”
I see what you mean in the Java case. It is true that Mustache templates, being logic-less, require all business logic to be implemented by the caller. If you’re confident that your change can address the requirements of JavaScript, Java and other languages whilst preserving or rectifying existing (mis-)behaviour as appropriate then I wish you good luck with the PR.
Cheers,
--A
From: Christophe Bornet [mailto:[email protected]]
Sent: 24 August 2016 10:38
To: swagger-api/swagger-codegen [email protected]
Cc: Adrian Price [email protected]; Mention [email protected]
Subject: [swagger-api/swagger-codegen] [All] Add a supportsMixin property to codegens (#3636)
The consequence is that since we don't have the interface properties in vars, we have to duplicate the code everywhere in the template to include both vars and interfaceModels.allVars
This could be mitigated by putting some parts of the code in imported templates but that would also make the template much harder to read.
So my idea is to add a supportsMixin property for languages that can use it (eg. Javascript)
@wing328 https://github.com/wing328 I can do the PR if OK.
cc @demonfiddler https://github.com/demonfiddler
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #3636 , or mute the thread https://github.com/notifications/unsubscribe-auth/ANXPu-LQXFPtjYdWifHJH72nzP8-49HQks5qjBDcgaJpZM4Jr0cq .
This email has been scanned by BullGuard antivirus protection.
For more info visit www.bullguard.com http://www.bullguard.com/tracking.aspx?affiliate=bullguard&buyaffiliate=smtp&url=/
wing328 commentedon Oct 3, 2016
PR merged into master