Skip to content

Hdpi 4131#1553

Open
AmandaRichards wants to merge 11 commits intomasterfrom
HDPI-4131
Open

Hdpi 4131#1553
AmandaRichards wants to merge 11 commits intomasterfrom
HDPI-4131

Conversation

@AmandaRichards
Copy link
Copy Markdown
Contributor

@AmandaRichards AmandaRichards commented Mar 23, 2026

Jira link

See HDPI-4131

Change description

Update full address on merge to ensure that changes to the optional field county are reflected in the db.

Testing done

Security Vulnerability Assessment

CVE Suppression: Are there any CVEs present in the codebase (either newly introduced or pre-existing) that are being intentionally suppressed or ignored by this commit?

  • Yes
  • No

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

CCD diff summary

👉 Full report: https://github.com/hmcts/pcs-api/actions/runs/23585426217?check_suite_focus=true

No change

@hmcts-jenkins-j-to-z hmcts-jenkins-j-to-z bot requested a deployment to preview March 23, 2026 15:38 Abandoned
@hmcts-jenkins-j-to-z hmcts-jenkins-j-to-z bot requested a deployment to preview March 23, 2026 15:47 Abandoned
@hmcts-jenkins-j-to-z hmcts-jenkins-j-to-z bot requested a deployment to preview March 23, 2026 16:04 Abandoned
Copy link
Copy Markdown
Contributor

@tvr-hmcts tvr-hmcts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minors ...

return DynamicStringListElement.builder().code(value.name()).label(value.getLabel()).build();
}


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor vertical spacing

return;
}

Iterator<Map.Entry<String, JsonNode>> fields = patch.fields();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fields() is depricated so you can use patch.properties().iterator();

* Fully replaces the old address rather than merging individual fields.
*/
private void clearAddressFieldsInBase(JsonNode base, JsonNode patch) {
clearAddressFieldsRecursively(base, patch);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for this to actually have this wrapping method?

JsonNode baseChild = base.get(fieldName);

if ("address".equalsIgnoreCase(fieldName) && patchChild.isObject() && baseChild.isObject()) {
clearAddressFields((ObjectNode) baseChild);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need checking before casting?

import uk.gov.hmcts.reform.pcs.config.JacksonConfiguration;

import com.fasterxml.jackson.databind.JsonNode;
import static org.assertj.core.api.Assertions.assertThat;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the static usually goes at the footer of the list


@Test
void shouldClearAddressFieldsWhenPatchContainsAddress() throws Exception {
String baseJson = """
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Given


@Test
void shouldNotClearAddressIfPatchDoesNotContainAddress() throws Exception {
String baseJson = """
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Given

@hmcts-jenkins-j-to-z
Copy link
Copy Markdown
Contributor

Plan Result (aat)

No changes. Your infrastructure matches the configuration.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants