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 1 commit into
keycloak:mainfrom
shawkins:iss44159
Open

shawkins wants to merge 1 commit 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

closes: keycloak#44159

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
@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

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