Skip to content

feat(api): add PreSignedUrlConvertResponse for PresignedUrlTarget#537

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

feat(api): add PreSignedUrlConvertResponse for PresignedUrlTarget#537
dan-m62 wants to merge 1 commit into
docling-project:mainfrom
dan-m62:feat/presigned-url-response-completion

Conversation

@dan-m62

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

Copy link
Copy Markdown

Companion to #535, completing the request/response round-trip for the PresignedUrlTarget flow introduced in docling-serve v1.22.0+. When a client submits {"target": {"kind": "presigned_url"}}, the
server's response shape (PresignedUrlConvertResponse on the Python side) carries:

  • aggregate counts (num_converted / num_succeeded / num_partially_succeeded / num_failed / processing_time)
  • a documents[] array with per-source artifact metadata: source_index, source_uri, filename, status, errors, timings, and artifacts[] (per output format: artifact_type, mime_type, uri,
    url_expires_at)

This is structurally distinct from the existing PreSignedUrlConvertDocumentResponse (added by #388), which carries only the aggregate counts and is what the server returns for s3 / put targets. The Python
equivalents are similarly two distinct classes — PresignedUrlConvertDocumentResponse (counts only) and PresignedUrlConvertResponse (counts + documents). The existing Java class is unchanged.

This commit adds:

  • PreSignedUrlConvertResponse.java: new sibling under the sealed ConvertDocumentResponse hierarchy, fingerprinted by the presence of documents (Jackson JsonTypeInfo.Id.DEDUCTION, consistent with the
    rest of this hierarchy — the wire response carries no kind discriminator)
  • DocumentArtifactItem.java, ArtifactRef.java, ArtifactType.java, ConversionStatus.java, ProfilingItem.java, ProfilingScope.java: supporting types, fields verified 1:1 against docling-slim 2.99.0
  • ResponseType.java: extend with PRE_SIGNED_URL_RESPONSE
  • ConvertDocumentResponse.java: extend permits and @JsonSubTypes
  • ArtifactRefTests, DocumentArtifactItemTests, and two new methods on ConvertDocumentResponseTests covering builder + null-collection + immutability assertions, matching the test scope of the other
    response tests in this module

docling-serve has two distinct response classes for presigned-URL flows
(responses.py:236-243):

  - PresignedUrlConvertDocumentResponse: counts-only response returned
    when the request targets S3Target or PutTarget, where the document
    content is delivered out-of-band to the client-supplied target.
  - PresignedUrlConvertResponse: counts plus a per-source documents list
    returned when the request targets PresignedUrlTarget, where the
    server uploads each artifact to its own object storage and returns
    presigned GET URLs in-band.

The existing PreSignedUrlConvertDocumentResponse covers the first case.
This commit adds the second as a sibling class under the existing
sealed ConvertDocumentResponse hierarchy, plus the supporting types
referenced by it:

  - PreSignedUrlConvertResponse: final, mirrors all counts plus a
    documents field, returns ResponseType.PRE_SIGNED_URL_RESPONSE.
  - DocumentArtifactItem: per-source entry on the response.
  - ArtifactRef: a single presigned URL plus its artifact_type,
    mime_type, and url_expires_at.
  - ArtifactType: enum discriminating which output format the artifact
    represents (JSON, HTML, MARKDOWN, TEXT, DOCTAGS, RESOURCE_BUNDLE).
  - ConversionStatus: enum for the terminal per-document outcome
    (PENDING, STARTED, SUCCESS, PARTIAL_SUCCESS, FAILURE, SKIPPED).
  - ProfilingItem: per-stage timing record, populated when
    DOCLING_DEBUG_PROFILE_PIPELINE_TIMINGS=true on the worker.
  - ProfilingScope: enum for ProfilingItem.scope (PAGE, DOCUMENT).

ConvertDocumentResponse permits clause and @JsonSubTypes are updated to
include the new subtype. Jackson's DEDUCTION dispatch routes responses
carrying a documents field to PreSignedUrlConvertResponse and
counts-only responses to PreSignedUrlConvertDocumentResponse.

The existing PreSignedUrlConvertDocumentResponse, its tests, and the
ResponseType.PRE_SIGNED_URL value are unchanged. ResponseType gains a
new PRE_SIGNED_URL_RESPONSE entry for the new sibling, and its class-
level javadoc is updated to correct the previous description of
PRE_SIGNED_URL ("packaged as a ZIP archive and uploaded to the given
target URI") which inverted the relationship.

Tests follow the established target-test pattern: builder construction
plus AssertJ getter assertions for the new types and a both-null and
all-fields pair on ConvertDocumentResponseTests for the new sibling.

Signed-off-by: Daniel Imber <dimber@m62.ai>
@edeandrea

Copy link
Copy Markdown
Contributor

Hi @dan-m62 thank you for this work! I have similar comments here about the tests as I did in #535. The tests here really don't provide any indication that the json marshalling is correct and that it serializes/deserializes properly.

t 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 the other half of #541

@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 PreSignedUrlConvertResponse and the supporting model types — 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