Skip to content

feat(api): add PresignedUrlTarget for v1.22 S3 delivery#535

Closed
dan-m62 wants to merge 1 commit into
docling-project:mainfrom
dan-m62:feat/presigned-url-target
Closed

feat(api): add PresignedUrlTarget for v1.22 S3 delivery#535
dan-m62 wants to merge 1 commit into
docling-project:mainfrom
dan-m62:feat/presigned-url-target

Conversation

@dan-m62

@dan-m62 dan-m62 commented Jun 12, 2026

Copy link
Copy Markdown

docling-serve v1.22.0+ introduces a server-managed presigned-URL delivery mode: the operator configures DOCLING_SERVE_ARTIFACT_STORAGE_* settings, clients request {"target": {"kind": "presigned_url"}}, and the server uploads each output artifact to its own bucket and returns time-limited presigned GET URLs in the response.

The response side of this surface (PreSignedUrlConvertDocumentResponse) exists via #388 but the request side was not added at the same time. Because Target is sealed, downstream users cannot supply their own subtype — they either bypass the SDK to hand-build the request JSON, or fork.

This commit adds PresignedUrlTarget as a permitted subtype of Target, mirroring the existing trivial-marker pattern used by InBodyTarget and ZipTarget i.e.:

  • PresignedUrlTarget.java: empty marker with the standard builder
  • Target.java: extend permits (alphabetical), @JsonSubTypes, and Kind enum with the presigned_url discriminator
  • PresignedUrlTargetTests.java: builder + Target-subtype + toBuilder roundtrip assertions, matching the test scope of the other target tests in this module

docling-serve v1.22.0 introduces a server-managed presigned-URL delivery
mode: the operator configures DOCLING_SERVE_ARTIFACT_STORAGE_* settings,
clients request `{"target": {"kind": "presigned_url"}}`, and the server
uploads each output artifact to its own bucket and returns time-limited
presigned GET URLs in the response.

The response side of this surface (PreSignedUrlConvertDocumentResponse)
landed in docling-project#388 but the request side was not added at the same time.
Because `Target` is sealed, downstream users cannot supply their own
subtype — they either bypass the SDK to hand-build the request JSON, or
fork.

This commit closes the gap by adding PresignedUrlTarget as a permitted
subtype of Target, mirroring the existing trivial-marker pattern used
by InBodyTarget and ZipTarget:

  - PresignedUrlTarget.java: empty marker with the standard builder
  - Target.java: extend permits (alphabetical), @JsonSubTypes, and Kind
    enum with the `presigned_url` discriminator
  - PresignedUrlTargetTests.java: builder + Target-subtype + toBuilder
    roundtrip assertions, matching the test scope of the other target
    tests in this module

Signed-off-by: Daniel Imber <dimber@m62.ai>
@dan-m62 dan-m62 force-pushed the feat/presigned-url-target branch from 8b4803b to bc12443 Compare June 12, 2026 19:08
@dan-m62 dan-m62 changed the title feat(serve-api): add PresignedUrlTarget for v1.22 S3 delivery feat(api): add PresignedUrlTarget for v1.22 S3 delivery Jun 12, 2026
@edeandrea

Copy link
Copy Markdown
Contributor

Hi @dan-m62 thank you for this!

Something I noticed - the PresignedUrlTargetTests that you added - they don't really test that the marshalling nor that the requests/responses actually work.

whenBuiltThenIsTargetSubtype and whenBuiltThenInstanceCreated tests are pretty pointless to be honest. It would be better if there were some functional tests in AbstractDoclingServeClientTests that verified that the docling-serve instance actually did things the way it was supposed to based on the input.

@edeandrea

Copy link
Copy Markdown
Contributor

This is 1/2 the implementation of #541

@edeandrea

Copy link
Copy Markdown
Contributor

@all-contributors add @dan-m62 for code, idea

@allcontributors

Copy link
Copy Markdown
Contributor

@edeandrea

I've put up a pull request to add @dan-m62! 🎉

@edeandrea

Copy link
Copy Markdown
Contributor

Closing in favor of #543, which builds on the foundation you laid here. Thank you @dan-m62 for your work on PresignedUrlTarget — it provided the starting point for the consolidated PR.

@edeandrea edeandrea closed this Jun 15, 2026
edeandrea added a commit to edeandrea/docling-java that referenced this pull request Jun 15, 2026
Add support for the presigned-URL delivery mode introduced in
docling-serve v1.22.0. Clients can now request
`{"target": {"kind": "presigned_url"}}` and receive per-document
artifact download URLs in a `PreSignedUrlConvertResponse`.

New request target:
- `PresignedUrlTarget` — marker class in the `Target` sealed hierarchy

New response types:
- `PreSignedUrlConvertResponse` — extends `ConvertDocumentResponse`
  with a `documents` list and aggregate conversion stats
- `DocumentArtifactItem` — per-document result with status and artifacts
- `ArtifactRef` — presigned download URL with expiry timestamp
- Supporting enums: `ArtifactType`, `ConversionStatus`,
  `ProfilingScope`
- Supporting type: `ProfilingItem` for per-stage timing data

Additional changes:
- Custom `Instant` serializers/deserializers for Jackson 2 and 3,
  following the existing `Duration` serializer pattern
- `PreSignedUrlConvertDocumentResponse` gains `numPartiallySucceeded`
  field to align with the current OpenAPI spec
- `ConvertOperations` treats `PresignedUrlTarget` as a remote target
- `ConvertDocumentResponse` uses `defaultImpl` for Jackson DEDUCTION
  to resolve ambiguity with `PreSignedUrlConvertDocumentResponse`
- Default Testcontainers image upgraded from v1.19.0 to v1.24.0
- WireMock functional tests verify full request/response round-trip
- Documentation updated across all relevant files

This work builds on the foundation laid by @dan-m62 in docling-project#535 and docling-project#537.

Closes docling-project#541

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
edeandrea added a commit to edeandrea/docling-java that referenced this pull request Jun 15, 2026
Add support for the presigned-URL delivery mode introduced in
docling-serve v1.22.0. Clients can now request
`{"target": {"kind": "presigned_url"}}` and receive per-document
artifact download URLs in a `PreSignedUrlConvertResponse`.

New request target:
- `PresignedUrlTarget` — marker class in the `Target` sealed hierarchy

New response types:
- `PreSignedUrlConvertResponse` — extends `ConvertDocumentResponse`
  with a `documents` list and aggregate conversion stats
- `DocumentArtifactItem` — per-document result with status and artifacts
- `ArtifactRef` — presigned download URL with expiry timestamp
- Supporting enums: `ArtifactType`, `ConversionStatus`,
  `ProfilingScope`
- Supporting type: `ProfilingItem` for per-stage timing data

Additional changes:
- Custom `Instant` serializers/deserializers for Jackson 2 and 3,
  following the existing `Duration` serializer pattern
- Custom `ConvertDocumentResponse` deserializers for Jackson 2 and 3
  that dispatch based on distinguishing JSON fields and fail fast on
  unknown shapes (replaces `@JsonTypeInfo(DEDUCTION)`)
- `PreSignedUrlConvertDocumentResponse` gains `numPartiallySucceeded`
  field to align with the current OpenAPI spec
- `ConvertOperations` treats `PresignedUrlTarget` as a remote target
- Default Testcontainers image upgraded from v1.19.0 to v1.24.0
- WireMock functional tests verify full request/response round-trip
- Documentation updated across all relevant files

This work builds on the foundation laid by @dan-m62 in docling-project#535 and docling-project#537.

Closes docling-project#541

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
edeandrea added a commit to edeandrea/docling-java that referenced this pull request Jun 15, 2026
Add support for the presigned-URL delivery mode introduced in
docling-serve v1.22.0. Clients can now request
`{"target": {"kind": "presigned_url"}}` and receive per-document
artifact download URLs in a `PreSignedUrlConvertResponse`.

New request target:
- `PresignedUrlTarget` — marker class in the `Target` sealed hierarchy

New response types:
- `PreSignedUrlConvertResponse` — extends `ConvertDocumentResponse`
  with a `documents` list and aggregate conversion stats
- `DocumentArtifactItem` — per-document result with status and artifacts
- `ArtifactRef` — presigned download URL with expiry timestamp
- Supporting enums: `ArtifactType`, `ConversionStatus`,
  `ProfilingScope`
- Supporting type: `ProfilingItem` for per-stage timing data

Additional changes:
- Custom `Instant` serializers/deserializers for Jackson 2 and 3,
  following the existing `Duration` serializer pattern
- Custom `ConvertDocumentResponse` deserializers for Jackson 2 and 3
  that dispatch based on distinguishing JSON fields and fail fast on
  unknown shapes (replaces `@JsonTypeInfo(DEDUCTION)`)
- `PreSignedUrlConvertDocumentResponse` gains `numPartiallySucceeded`
  field to align with the current OpenAPI spec
- `ConvertOperations` treats `PresignedUrlTarget` as a remote target
- Default Testcontainers image upgraded from v1.19.0 to v1.24.0
- WireMock functional tests verify full request/response round-trip
- Documentation updated across all relevant files

This work builds on the foundation laid by @dan-m62 in docling-project#535 and docling-project#537.

Closes docling-project#541

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
edeandrea added a commit that referenced this pull request Jun 15, 2026
Add support for the presigned-URL delivery mode introduced in
docling-serve v1.22.0. Clients can now request
`{"target": {"kind": "presigned_url"}}` and receive per-document
artifact download URLs in a `PreSignedUrlConvertResponse`.

New request target:
- `PresignedUrlTarget` — marker class in the `Target` sealed hierarchy

New response types:
- `PreSignedUrlConvertResponse` — extends `ConvertDocumentResponse`
  with a `documents` list and aggregate conversion stats
- `DocumentArtifactItem` — per-document result with status and artifacts
- `ArtifactRef` — presigned download URL with expiry timestamp
- Supporting enums: `ArtifactType`, `ConversionStatus`,
  `ProfilingScope`
- Supporting type: `ProfilingItem` for per-stage timing data

Additional changes:
- Custom `Instant` serializers/deserializers for Jackson 2 and 3,
  following the existing `Duration` serializer pattern
- Custom `ConvertDocumentResponse` deserializers for Jackson 2 and 3
  that dispatch based on distinguishing JSON fields and fail fast on
  unknown shapes (replaces `@JsonTypeInfo(DEDUCTION)`)
- `PreSignedUrlConvertDocumentResponse` gains `numPartiallySucceeded`
  field to align with the current OpenAPI spec
- `ConvertOperations` treats `PresignedUrlTarget` as a remote target
- Default Testcontainers image upgraded from v1.19.0 to v1.24.0
- WireMock functional tests verify full request/response round-trip
- Documentation updated across all relevant files

This work builds on the foundation laid by @dan-m62 in #535 and #537.

Closes #541

Assisted-By: Claude Code <noreply@anthropic.com>

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants