-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
feat!: adds inheritance with interfaces for java #1593
feat!: adds inheritance with interfaces for java #1593
Conversation
✅ Deploy Preview for modelina canceled.
|
@dlkj, perhaps you have some input here as a Java user who also might need this? Keep in mind that this is still a draft, but something we're prioritizing at the moment. |
@jonaslagoni, I'm also eager to hear your input on how this can be solved. Am I on the right track, or should this be solved in a different way? |
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.
Honestly looks pretty good to me 🤔
Looking forward to seeing this in C# and TypeScript.
My only concern would be how it handles multiple inheritance whenallOf
has multiple entries, in languages that only allow a single one? 🤔
Yep, representing |
Thanks for your feedback! I'm still working through issues we've found by generating code with these changes in our own codebase. Once I'm happy with the output I'll split this draft into multiple smaller PRs. @jonaslagoni, I think that should be the responsibility of the generator of the language. E.g. in Java, it's natural to use interfaces because it supports multiple, while extend only supports one. I think lots of other programming languages are in a similar situation as Java. |
Kudos, SonarCloud Quality Gate passed!
|
@jonaslagoni, please review |
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.
👍
/rtm |
🎉 This PR is included in version 3.0.0-next.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* feat!: convert to use multi parser (#1587) * feat!: adds support for duration in java (#1604) * feat: enable AsyncAPI v3 (#1600) * fix!: add csharp support for DateTime, TimeSpan, Guid (#1612) * feat!: adds extend in common, meta, and constrained models (#1613) * feat!: adds inheritance with interfaces for java (#1593) * chore: remove duplicate version entry for AsyncAPI processor (#1609) * feat!: render python union in pydantic in the pre 3.10 way (#1626) * feat: add file path as input (#1601) * feat!: add options as parameter to constraints (#1667) * fix: (un)marshalling tuple and dictionary unwrapping for Typescript (#1717) * fix: jsonbinpack preset and runtime tests (#1718) * chore: fix linting * chore: remove unused directory * feat!: add useJavascriptReservedKeywords option for TS (#1727) * feat: enable raw properties for interface (#1729) * fix: newtonsoft could not handle enum values (#1731) * chore: update Java runtime tests (#1739) * fix: edge case where references was incorrect handled for JSON Schema (#1754) * fix: recursion bug for get nearest dependencies (#1757) --------- Co-authored-by: Kenneth Aasan <k.aasan@sportradar.com> Co-authored-by: jano-petras <jano.petras@gmail.com> Co-authored-by: Nilkanth Parmar <parmarnilkanth@gmail.com>
🎉 This PR is included in version 4.0.0-next.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This MR adds inheritance with interfaces for Java. Our Java users are complaining about missing interfaces for schemas that include
allOf
. Unlike TypeScript, In Java, it's problematic to use classes without interfaces if lots of classes are similar. This is an attempt to fix that. This is a difficult one to solve in a good way, and the arguments in #108 describe that, but we need to find a way to improve the generated code for Java.Related issue(s)
See also #108 and #1613