Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

fix(JSON): Resolve mapping issues #44

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.github.flytreeleft.nexus3.keycloak.plugin.internal.http;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import org.keycloak.util.JsonSerialization;

import java.io.IOException;
Expand Down Expand Up @@ -33,6 +36,8 @@ public HttpMethodResponse<R> json(final TypeReference<R> responseType) {
public R execute() {
return method.execute((InputStream inputStream) -> {
try {
JsonSerialization.mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
JsonSerialization.mapper.setVisibility(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY));
return JsonSerialization.readValue(inputStream, responseType);
} catch (IOException e) {
throw new RuntimeException("Error parsing JSON response.", e);
Expand Down