-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Improve SimpleHttp API #46171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Improve SimpleHttp API #46171
Conversation
591b51e to
c67e3aa
Compare
- Expose configured HTTP method from SimpleHttpRequest - Use same ObjectMapper configuration as in JsonSerialization used by the deprecated SimpleHTTP - Allow to configure the ObjectMapper to use by SimpleHttp - Expose ObjectMapper factory methods in JsonSerialization Fixes keycloak#43701 Signed-off-by: Thomas Darimont <[email protected]>
Replace usage of deprecated method ``` mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); ``` with supported variant. Signed-off-by: Thomas Darimont <[email protected]>
c67e3aa to
cec658f
Compare
server-spi-private/src/main/java/org/keycloak/http/simple/SimpleHttp.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Martin Bartoš <[email protected]> Signed-off-by: Thomas Darimont <[email protected]>
|
Thanks @mabartos for taking a look! I intentially created a new instance to avoid potential mutations of the shared ObjectMapper to have an affect the SimpleHTTP json serialization, but perhaps that was not necessary. I applied your suggestion to reuse the JsonSerialization.mapper reference directly. I keep the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.broker.KcOidcBrokerTest#loginWithExistingUserWithBruteForceEnabledKeycloak CI - Java Distribution IT (windows-latest - temurin - 21) |
mabartos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomasdarimont LGTM, thanks!
@keycloak/core As it is your area, could you please check this simple PR? Thanks!
@stianst You were involved in the older PR related to this - do you wanna review it as well?
| mapper.registerModule(new JavaTimeModule()); | ||
| mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); | ||
| mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for context for another reviewer - the setSerializationInclusion() is deprecated, and uses the setDefaultPropertyInclusion underhood (setSerializationInclusion -> setPropertyInclusion -> setDefaultPropertyInclusion).
So, ok from my side, as there should not be any behavioral changes provided here.
Fixes #43701
Followup to #43702