Skip to content

Preserve instance URIs in the Gson adapter - #564

Open
PHJ2000 wants to merge 1 commit into
zalando:mainfrom
PHJ2000:fix-gson-instance-uri
Open

PHJ2000 wants to merge 1 commit into
zalando:mainfrom
PHJ2000:fix-gson-instance-uri

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 5, 2026

Copy link
Copy Markdown

Description

Use Gson's URI adapter for instance and retain the existing type-specific adapter for type. This preserves null instances and explicitly supplied about:blank instances.

Motivation and Context

The shared adapter currently turns null instances into about:blank on reading and drops about:blank instances on writing. The null case also occurs when round-tripping a normal problem with serializeNulls().

Fixes #563.

Validation: four regression tests added (three fail before the fix); mvn -B -ntp clean verify passes all 123 tests on Java 21. DefaultProblemAdapter has 100% line and branch coverage.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Apply about:blank defaulting only to type so null instances remain null and explicit about:blank instances survive serialization.

Signed-off-by: PHJ2000 <105151063+PHJ2000@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

Gson adapter changes null instances to about:blank

1 participant