8000 fix: consolidating rest layer object mapper by shawkins · Pull Request #54909 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: consolidating rest layer object mapper - #54909

Open
shawkins wants to merge 2 commits into
keycloak:mainfrom
shawkins:iss44159
Open

shawkins wants to merge 2 commits into
keycloak:mainfrom
shawkins:iss44159

Conversation

@shawkins
@shawkins shawkins commented Nov 9, 2026 •
Copy link
Copy Markdown
Contributor

Inverts our creation of the rest layer objectmapper, so that we are reusing the quarkus one. We could move our customizations to the application.properties.

This reduces our memory footprint a little and let's and users or support issues use quarkus properties to workaround serialization / deserialization issues if needed.

closes: #44159

Copilot AI left a comment
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.

🟡 Changes recommended

The patch contains a non-compiling ObjectReader call and unconditional Jackson overrides that prevent explicit Quarkus configuration from taking effect.

1 open issue
What changed in this PR

This PR consolidates REST-layer JSON handling around Quarkus’s managed ObjectMapper, reducing duplicate mapper instances while retaining Keycloak-specific configuration.

Changes:

  • Replaces the Quarkus mapper resolver with an ObjectMapperCustomizer.
  • Adds a shared mapper accessor to session factories, with a fallback for non-Quarkus runtimes.
  • Updates admin-v2 merge-patch handling and RESTEasy test setup to use the revised mapper APIs.
File Description
services/​src/​test/​java/​org/​keycloak/​services/​resteasy/​ResteasyKeycloakApplication.java Supplies an explicit mapper to the test resolver.
services/​src/​main/​java/​org/​keycloak/​services/​util/​ObjectMapperResolver.java Extracts reusable configuration and accepts an injected mapper.
services/​src/​main/​java/​org/​keycloak/​services/​DefaultKeycloakSessionFactory.java Adds lazy access to a shared fallback mapper.
rest/​admin-v2/​services/​src/​main/​java/​org/​keycloak/​rest/​admin/​api/​client/​DefaultClientApi.java Uses the shared mapper for merge-patch processing.
quarkus/​runtime/​src/​main/​java/​org/​keycloak/​quarkus/​runtime/​integration/​QuarkusKeycloakSessionFactory.java Retrieves the Quarkus-managed mapper.
quarkus/​runtime/​src/​main/​java/​org/​keycloak/​quarkus/​runtime/​integration/​jaxrs/​KeycloakObjectMapperCustomizer.java Applies Keycloak configuration through a Quarkus customizer.

Review effort: Balanced

@shawkins
shawkins force-pushed the iss44159 branch 2 times, most recently from f87d17b to 2a7d0f8 Compare November 10, 2026 19:23
@shawkins
shawkins force-pushed the iss44159 branch 2 times, most recently from b9ed14e to 9b76874 Compare November 10, 2026 22:00
@shawkins
shawkins marked this pull request as ready for review November 10, 2026 22:19
@shawkins
shawkins requested review from a team as code owners November 10, 2026 22:19
@shawkins
shawkins requested review from Pepo48 and vmuzikar and a balanced review from Copilot November 10, 2026 22:19
Copilot AI left a comment
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.

🔵 Needs a closer look

Regression coverage is missing for how the mapper customizations interact with quarkus.jackson.* overrides, including default unknown-field rejection, an explicit override, and continued trailing-token rejection in PATCH requests.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:39
Copilot AI left a comment
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.

🔵 Needs a closer look

The shared Quarkus mapper changes serializer selection and customizer precedence across REST and single-file exports, requiring runtime validation of configuration overrides and export/import compatibility unavailable in this source-only review.

No open issues 🎉

Review effort: Balanced

@shawkins
Copy link
Copy Markdown
Contributor Author

Updated to be more aggressive in consolidation.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 17:54
Copilot AI left a comment
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.

🟡 Changes recommended

The export writer inherits REST serialization overrides that can rename fields, producing backup files the importer rejects.

1 open issue

Review effort: Balanced

@shawkins
shawkins marked this pull request as draft November 11, 2026 18:04
@shawkins
shawkins requested a balanced review from Copilot November 11, 2026 20:53
also consolidating the creation of other object mappers

closes: keycloak#44159

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Copilot AI left a comment
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.

🟢 Approval recommended

The review reports no active issues with the JSON mapper consolidation.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@shawkins
shawkins marked this pull request as ready for review November 11, 2026 21:35
that doesn't need to be spelled out

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 23:45
Copilot AI left a comment
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.

🔵 Needs a closer look

Human assessment is needed because unpublished findings identify critical realm-data loss during full-model export and overrides that defeat explicit operator configuration.

No open issues 🎉

Review effort: Balanced

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.

Enhanced ObjectMapper instantiation for Client v2

2 participants

0