-
Notifications
You must be signed in to change notification settings - Fork 20
feat(api): add PresignedUrlTarget and PreSignedUrlConvertResponse #543
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
Merged
edeandrea
merged 1 commit into
docling-project:main
from
edeandrea:feat/presigned-url-target-response
Jun 15, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...rve-api/src/main/java/ai/docling/serve/api/convert/request/target/PresignedUrlTarget.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package ai.docling.serve.api.convert.request.target; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
|
||
| /** | ||
| * Target for delivering the converted document via server-managed presigned URLs. | ||
| * | ||
| * <p>This is a concrete implementation of {@link Target}, where the {@code Kind} is set to | ||
| * {@link Kind#PRESIGNED_URL}. The docling-serve instance uploads each output artifact to its | ||
| * own configured object storage bucket and returns time-limited presigned GET URLs in the | ||
| * response. | ||
| * | ||
| * <p>Available in docling-serve {@code v1.22.0} and later. | ||
| * | ||
| * <p>Uses JSON serialization annotations to include only non-empty fields in the output. | ||
| * | ||
| * <p>This class overrides {@link Object#toString()} for a string representation of the instance. | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| @tools.jackson.databind.annotation.JsonDeserialize(builder = PresignedUrlTarget.Builder.class) | ||
| @lombok.extern.jackson.Jacksonized | ||
| @lombok.Builder(toBuilder = true) | ||
| @lombok.Getter | ||
| @lombok.ToString | ||
| public final class PresignedUrlTarget extends Target { | ||
|
|
||
| /** | ||
| * Builder for creating {@link PresignedUrlTarget} instances. | ||
| * Generated by Lombok's {@code @Builder} annotation. | ||
| */ | ||
| @tools.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") | ||
| public static class Builder { } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...ve/docling-serve-api/src/main/java/ai/docling/serve/api/convert/response/ArtifactRef.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| package ai.docling.serve.api.convert.response; | ||
|
|
||
| import java.net.URI; | ||
| import java.time.Instant; | ||
|
|
||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
|
|
||
| import ai.docling.serve.api.serialization.Jackson2InstantDeserializer; | ||
| import ai.docling.serve.api.serialization.Jackson2InstantSerializer; | ||
| import ai.docling.serve.api.serialization.Jackson3InstantDeserializer; | ||
| import ai.docling.serve.api.serialization.Jackson3InstantSerializer; | ||
|
|
||
| /** | ||
| * Represents a reference to a single output artifact returned as a presigned URL. | ||
| * | ||
| * <p>Serialization uses {@link JsonInclude.Include#NON_EMPTY}, so nulls and empty | ||
| * fields are omitted from JSON output.</p> | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| @tools.jackson.databind.annotation.JsonDeserialize(builder = ArtifactRef.Builder.class) | ||
| @lombok.extern.jackson.Jacksonized | ||
| @lombok.Builder(toBuilder = true) | ||
| @lombok.Getter | ||
| @lombok.ToString | ||
| public class ArtifactRef { | ||
|
|
||
| /** | ||
| * Export format of the artifact. | ||
| * | ||
| * @param artifactType the artifact type | ||
| * @return the artifact type | ||
| */ | ||
| @JsonProperty("artifact_type") | ||
| @lombok.NonNull | ||
| private ArtifactType artifactType; | ||
|
|
||
| /** | ||
| * MIME type of the artifact content. | ||
| * | ||
| * @param mimeType the MIME type | ||
| * @return the MIME type | ||
| */ | ||
| @JsonProperty("mime_type") | ||
| @lombok.NonNull | ||
| private String mimeType; | ||
|
|
||
| /** | ||
| * Presigned URL used to download the artifact. | ||
| * | ||
| * @param uri the presigned URL | ||
| * @return the presigned URL | ||
| */ | ||
| @JsonProperty("uri") | ||
| @lombok.NonNull | ||
| private URI uri; | ||
|
|
||
| /** | ||
| * Instant at which the presigned URL signature stops being valid. | ||
| * | ||
| * @param urlExpiresAt the expiry timestamp | ||
| * @return the expiry timestamp | ||
| */ | ||
| @JsonProperty("url_expires_at") | ||
| @JsonSerialize(using = Jackson2InstantSerializer.class) | ||
| @JsonDeserialize(using = Jackson2InstantDeserializer.class) | ||
| @tools.jackson.databind.annotation.JsonSerialize(using = Jackson3InstantSerializer.class) | ||
| @tools.jackson.databind.annotation.JsonDeserialize(using = Jackson3InstantDeserializer.class) | ||
| @Nullable | ||
| private Instant urlExpiresAt; | ||
|
|
||
| /** | ||
| * Builder for creating {@link ArtifactRef} instances. | ||
| * Generated by Lombok's {@code @Builder} annotation. | ||
| * | ||
| * <p>Builder methods: | ||
| * <ul> | ||
| * <li>{@code artifactType(ArtifactType)} - Set the artifact type</li> | ||
| * <li>{@code mimeType(String)} - Set the MIME type</li> | ||
| * <li>{@code uri(URI)} - Set the presigned URL</li> | ||
| * <li>{@code urlExpiresAt(Instant)} - Set the expiry timestamp</li> | ||
| * </ul> | ||
| */ | ||
| @tools.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") | ||
| public static class Builder { } | ||
| } |
24 changes: 24 additions & 0 deletions
24
...e/docling-serve-api/src/main/java/ai/docling/serve/api/convert/response/ArtifactType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package ai.docling.serve.api.convert.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Represents the output format of a converted-document artifact. | ||
| * | ||
| * <ul> | ||
| * <li>{@code JSON}: Serialized {@code DoclingDocument} JSON.</li> | ||
| * <li>{@code HTML}: HTML rendering of the document.</li> | ||
| * <li>{@code MARKDOWN}: Markdown rendering of the document.</li> | ||
| * <li>{@code TEXT}: Plain-text rendering of the document.</li> | ||
| * <li>{@code DOCTAGS}: DocTags rendering of the document.</li> | ||
| * <li>{@code RESOURCE_BUNDLE}: ZIP archive containing extracted images and supporting resources.</li> | ||
| * </ul> | ||
| */ | ||
| public enum ArtifactType { | ||
| @JsonProperty("json") JSON, | ||
| @JsonProperty("html") HTML, | ||
| @JsonProperty("markdown") MARKDOWN, | ||
| @JsonProperty("text") TEXT, | ||
| @JsonProperty("doctags") DOCTAGS, | ||
| @JsonProperty("resource_bundle") RESOURCE_BUNDLE; | ||
| } |
24 changes: 24 additions & 0 deletions
24
...cling-serve-api/src/main/java/ai/docling/serve/api/convert/response/ConversionStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package ai.docling.serve.api.convert.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Represents the possible conversion outcomes for a document. | ||
| * | ||
| * <ul> | ||
| * <li>{@code PENDING}: Indicates that the conversion has not yet started.</li> | ||
| * <li>{@code STARTED}: Indicates that the conversion is currently in progress.</li> | ||
| * <li>{@code SUCCESS}: Indicates that all pages of the document were converted.</li> | ||
| * <li>{@code PARTIAL_SUCCESS}: Indicates that some pages were converted and others failed.</li> | ||
| * <li>{@code FAILURE}: Indicates that the document could not be converted.</li> | ||
| * <li>{@code SKIPPED}: Indicates that the document was rejected at admission.</li> | ||
| * </ul> | ||
| */ | ||
| public enum ConversionStatus { | ||
| @JsonProperty("pending") PENDING, | ||
| @JsonProperty("started") STARTED, | ||
| @JsonProperty("success") SUCCESS, | ||
| @JsonProperty("partial_success") PARTIAL_SUCCESS, | ||
| @JsonProperty("failure") FAILURE, | ||
| @JsonProperty("skipped") SKIPPED; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
...g-serve-api/src/main/java/ai/docling/serve/api/convert/response/DocumentArtifactItem.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| package ai.docling.serve.api.convert.response; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.annotation.JsonSetter; | ||
| import com.fasterxml.jackson.annotation.Nulls; | ||
|
|
||
| /** | ||
| * Represents the conversion outcome and artifact references for a single source document. | ||
| * | ||
| * <p>Serialization uses {@link JsonInclude.Include#NON_EMPTY}, so nulls and empty | ||
| * collections are omitted from JSON output.</p> | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| @tools.jackson.databind.annotation.JsonDeserialize(builder = DocumentArtifactItem.Builder.class) | ||
| @lombok.extern.jackson.Jacksonized | ||
| @lombok.Builder(toBuilder = true) | ||
| @lombok.Getter | ||
| @lombok.ToString | ||
| public class DocumentArtifactItem { | ||
|
|
||
| /** | ||
| * Zero-based index of the source document within the originating task. | ||
| * | ||
| * @param sourceIndex the source index | ||
| * @return the source index | ||
| */ | ||
| @JsonProperty("source_index") | ||
| private Integer sourceIndex; | ||
|
edeandrea marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Canonical identifier of the source document. | ||
| * | ||
| * @param sourceUri the source URI | ||
| * @return the source URI | ||
| */ | ||
| @JsonProperty("source_uri") | ||
| @lombok.NonNull | ||
| private String sourceUri; | ||
|
|
||
| /** | ||
| * Filename used as the stem of each output artifact. | ||
| * | ||
| * @param filename the source filename | ||
| * @return the source filename | ||
| */ | ||
| @JsonProperty("filename") | ||
| @lombok.NonNull | ||
| private String filename; | ||
|
|
||
| /** | ||
| * Terminal conversion outcome for this document. | ||
| * | ||
| * @param status the conversion status | ||
| * @return the conversion status | ||
| */ | ||
| @JsonProperty("status") | ||
| @lombok.NonNull | ||
| private ConversionStatus status; | ||
|
|
||
| /** | ||
| * Errors encountered while converting this document. | ||
| * | ||
| * @param errors the list of errors | ||
| * @return the list of errors | ||
| */ | ||
| @JsonProperty("errors") | ||
| @JsonSetter(nulls = Nulls.AS_EMPTY) | ||
| @lombok.Singular | ||
| private List<ErrorItem> errors; | ||
|
|
||
| /** | ||
| * Per-stage timing breakdown keyed by stage name. | ||
| * | ||
| * @param timings the timings map | ||
| * @return the timings map | ||
| */ | ||
| @JsonProperty("timings") | ||
| @JsonSetter(nulls = Nulls.AS_EMPTY) | ||
| @lombok.Singular | ||
| private Map<String, ProfilingItem> timings; | ||
|
|
||
| /** | ||
| * Presigned URLs for each requested output format. | ||
| * | ||
| * @param artifacts the list of artifact references | ||
| * @return the list of artifact references | ||
| */ | ||
| @JsonProperty("artifacts") | ||
| @JsonSetter(nulls = Nulls.AS_EMPTY) | ||
| @lombok.Singular | ||
| private List<ArtifactRef> artifacts; | ||
|
|
||
| /** | ||
| * Builder for creating {@link DocumentArtifactItem} instances. | ||
| * Generated by Lombok's {@code @Builder} annotation. | ||
| * | ||
| * <p>Builder methods: | ||
| * <ul> | ||
| * <li>{@code sourceIndex(Integer)} - Set the source index</li> | ||
| * <li>{@code sourceUri(String)} - Set the source URI</li> | ||
| * <li>{@code filename(String)} - Set the source filename</li> | ||
| * <li>{@code status(ConversionStatus)} - Set the conversion status</li> | ||
| * <li>{@code errors(List<ErrorItem>)} - Set the list of errors</li> | ||
| * <li>{@code error(ErrorItem)} - Add a single error (use with @Singular)</li> | ||
| * <li>{@code timings(Map<String, ProfilingItem>)} - Set the timings map</li> | ||
| * <li>{@code timing(String, ProfilingItem)} - Add a single timing entry (use with @Singular)</li> | ||
| * <li>{@code artifacts(List<ArtifactRef>)} - Set the list of artifact references</li> | ||
| * <li>{@code artifact(ArtifactRef)} - Add a single artifact reference (use with @Singular)</li> | ||
| * </ul> | ||
| */ | ||
| @tools.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") | ||
| public static class Builder { } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.