Skip to content

Conversation

@edeandrea
Copy link
Contributor

Also enabled parallel builds & build caching for performance.

As part of this I did some refactoring as well (all backwards-compatible).

  • I refactored DoclingServeApi into smaller interfaces that match the operations within docling serve (chunk, clear, convert, health, task)
  • The DoclingServeApi simply extends all of them, but the operation definitions have been moved down into separate interfaces.
  • This will also allow consumers who only care about docling-serve-api to implement the parts of the api that they want to.

I did a similar refactoring to match in DoclingServeClient.

  • DoclingServeClient still implements all of the methods directly, but it delegates to various Operations classes that implement the actual apis.

All-in-all it doesn't affect functionality, but I feel it improves readability & maintainability.

I also refactored AbstractDoclingServeClientTests to introduce @Nested classes, again 1 each for the various APIs.

Fixes #188

@edeandrea edeandrea added enhancement New feature or request module:docling-serve-api The docling-serve-api module module:docling-serve-client The docling-serve-client module area:docling-serve Something related to docling-serve labels Dec 9, 2025
@edeandrea edeandrea mentioned this pull request Dec 9, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 9, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 9, 2025
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

TestsPassed ✅SkippedFailed
Gradle Test Results (all modules & JDKs)570 ran570 passed0 skipped0 failed
TestResult
No test annotations available

@edeandrea
Copy link
Contributor Author

edeandrea commented Dec 10, 2025

@ThomasVitale / @oscerd one thing I went back and forth on was the best way to model things that are path/query parameters.

Most of the other operations are POSTs where the uri is "static" and the request object we build is marshalled to json and sent in the request body.

With the task & clear apis, some of the uris have path & query parameters, and mostly are GETs. In this PR I modeled it as a request object, like this for example

@lombok.Builder(toBuilder = true)
@lombok.Getter
@lombok.ToString
public class TaskStatusPollRequest {
  public static final Duration DEFAULT_STATUS_POLL_WAIT_TIME = Duration.ZERO;

  @lombok.NonNull
  private String taskId;

  @lombok.Builder.Default
  @lombok.NonNull
  private Duration waitTime = DEFAULT_STATUS_POLL_WAIT_TIME;
}

And the corresponding operation is defined as TaskStatusPollResponse pollTaskStatus(TaskStatusPollRequest request);

In this case there isn't any serialization because the object itself is never serialized. The taskId is a path parameter and the waitTime is a query parameter in the http request.

Would it be better to not include things that are path/query params in these request objects, and instead make them parameters of the operation itself?

So

TaskStatusPollResponse pollTaskStatus(TaskStatusPollRequest request);

would become

TaskStatusPollResponse pollTaskStatus(String taskId, Duration waitTime);

It makes the method more fragile, but that might be a good thing since these are required things in the API. The more I think about it the more I think we should only model things that are part of a request/response body. These other things should go directly into the operation's method signature.

Thoughts?

Also enabled parallel builds for performance

Fixes docling-project#188

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
Also enabled parallel builds for performance

Fixes docling-project#188

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
Also enabled parallel builds for performance

Fixes docling-project#188

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@edeandrea
Copy link
Contributor Author

After thinking about it more, I decided to go ahead and make the change. Things that are required that are outside the request body (i.e. path/query params) I added directly to the method signature.

Also enabled parallel builds for performance

Fixes docling-project#188

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@oscerd
Copy link
Contributor

oscerd commented Dec 11, 2025

I started to work on the async support part, I'll have to aligned with this once it is merged.

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@docling-project docling-project deleted a comment from github-actions bot Dec 11, 2025
@github-actions
Copy link

:java_duke: JaCoCo coverage report

Overall Project 40.84% 🔴

There is no coverage information present for the Files changed

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea edeandrea merged commit 2dd85f2 into docling-project:main Dec 11, 2025
21 checks passed
@edeandrea edeandrea deleted the clear-task-apis branch December 11, 2025 14:35
@docling-java-ops docling-java-ops bot added the released Issue has been released label Dec 16, 2025
@docling-java-ops
Copy link
Contributor

🎉 This issue has been resolved in v0.4.0 (Release Notes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docling-serve Something related to docling-serve enhancement New feature or request module:docling-serve-api The docling-serve-api module module:docling-serve-client The docling-serve-client module released Issue has been released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement clear & tasks APIs

2 participants