Skip to content

CHD-3035 - accept both documentReference and documentReferenceUri on case document upload - #158

Merged
jayenhc merged 2 commits into
team/CHD-2786from
dev/CHD-3035-documenturi
Sep 28, 2026
Merged

jayenhc merged 2 commits into
team/CHD-2786from
dev/CHD-3035-documenturi

Conversation

@aykutdanisman

Copy link
Copy Markdown
Contributor

Problem

After #156, SJP accepted either a file service id (caseDocument / documentReference) or a blob uri (caseDocumentUri / documentReferenceUri), and the schemas enforced that with oneOf. staging-dvla now derives the case document uuid from the blob uri and sends both. With oneOf that payload is rejected. The processor also treated "uuid present" as meaning "file-service addressed", so material would have been sent a fileServiceId that no file service knows about.

Change

  • Schemas: upload-case-document command (api/controller/handler) and case-document-uploaded / case-document-upload-rejected events relaxed from oneOf to anyOf: at least one reference is required, and both are allowed.
  • Command handler: passes through whichever references arrive.
  • Aggregate (CaseDocumentHandler): rejection messages name the uri when there is one; both references stay on the event.
  • Event processor (CaseDocumentProcessor):
    • A document is blob-addressed when the uri is present. It no longer depends on the uuid being absent.
    • The public event and the sjp metadata carry both references, so handleMaterialAdded uses the caller's uuid instead of deriving a new one.
    • Material still gets exactly one reference (its upload-file command is an exclusive oneOf), and the uri wins when there is one.
    • The v3 uuid derived from the uri stays as the fallback for uri-only payloads and replayed events.
  • Query: documentUri added to CaseDocumentView and to the result-orders OrderView, with matching response schemas. The field is absent on the file-service path, so those responses don't change.

Verification

  • mvn -o -pl sjp-json,sjp-command/{api,controller,handler},sjp-domain/sjp-domain-aggregate,sjp-event/sjp-event-processor,sjp-query/{api,view} -am install: builds, unit tests pass.
  • New unit tests cover both references together in the command handler, the aggregate and the processor, plus the documentUri query views.
  • sjp-integration-test compiles (test-compile). AddCaseDocumentIT and CaseDocumentHelper were updated but not run locally.
  • ado.sh sonarlint team/CHD-2786: no new findings from this diff. The listed ones are stale or were already there.

🤖 Generated with Claude Code

…case document upload

staging-dvla now derives the case document uuid from the blob uri and sends
both. Relax the command and event schemas from oneOf to anyOf, treat the uri
(not an absent uuid) as the signal that a document is blob-addressed, carry
both references on the public event and sjp metadata, and send material only
the uri. Expose documentUri on case document and result order query views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aykutdanisman
aykutdanisman requested a review from a team as a code owner September 26, 2026 16:17
@aykutdanisman
aykutdanisman requested review from dawidstrozak, oleg-efrem-hmcts and raghendra and removed request for a team September 26, 2026 16:17
@cpp-github-management

Copy link
Copy Markdown

Failed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cpp-github-management

Copy link
Copy Markdown

Passed

@aykutdanisman
aykutdanisman requested review from jayenhc and removed request for jayenhc September 26, 2026 20:43
@jayenhc
jayenhc merged commit 4304a02 into team/CHD-2786 Sep 28, 2026
3 checks passed
@jayenhc
jayenhc deleted the dev/CHD-3035-documenturi branch September 28, 2026 14:43
jayenhc pushed a commit that referenced this pull request Sep 28, 2026
…ument id (#160)

The public case-document-uploaded event carries the caller's document
reference as documentId; #158 accidentally changed the expectation to caseId,
failing validation build 875649.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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