-
Notifications
You must be signed in to change notification settings - Fork 1
feat: idea for api design #27
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
base: main
Are you sure you want to change the base?
Conversation
|
@ThomasVitale @lordofthejars take a look and let me know what you think of this approach. I didn't get into ServiceLoaders or anything like that. I think that overcomplicates things. |
145e42f to
14aae2d
Compare
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.
Wow almost everything is done hahaha we are almost ready to go. Looks good to me just one small comment.
| import ai.docling.api.convert.response.ConvertDocumentResponse; | ||
| import ai.docling.api.health.HealthCheckResponse; | ||
|
|
||
| import static ai.docling.api.util.ValidationUtils.*; |
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.
Do we want to use the star import? I am not saying it isbad I am just wondering
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.
Usually for * static imports my general rule of thumb (for myself at least) is that if its an internal class local to the codebase, then its ok, but if its pulling in 3rd party class/library then I tend to not import static *. Since ValidationUtils is part of the docling-java codebase (& It'll be used a lot) I tend to import static *.
I generally don't do any regular import *, only some import static *.
But I don't have a severely strong opinion on things. If @ThomasVitale @lordofthejars prefer never using import static * then thats fine too.
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.
It is good in my opinion, I was just raising for just in case IDE collapse the imports and you didn't notice
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.
I generally avoid star imports, but I guess there's some rule in the .editorconfig file forcing them because I noticed that in my previous PR I got some star imports automatically applied, removing my explicit ones.
I'm fine either way, as long as we're consistent and we can automate the enforcement of whatever rule we decide to be compliant with.
Well, not really :) This is just a design idea that I've only implemented for one of the model objects to show the idea/pattern. If we want to adopt this pattern then we need to implement it across the board. Then we need documentation, release automation, etc :) |
Perfect, looks good to me, then we erge this one and we adapt the rest of the model, or we push ito this PR? |
If we like this model then I'll fill in this PR with the rest of the API (its currently marked as draft). I'd like Thomas to weigh in first though, since he was the one who built the initial version. |
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
|
Thanks for this PR! In general, I like the approach, but I have two concerns:
|
An idea for api design. This still allows using Java records to implement the model objects, but also makes these objects backwards-compatible by introducing interfaces & builders.
NOTE I've only applied the pattern to the
DocumentResponseso that we can decide if this is a good approach or not. If so, we can apply this pattern to the others.FIxes #23