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

Commit

Permalink
Merge pull request #44 from hypery2k/bugfix/43_http_method_errors
Browse files Browse the repository at this point in the history
fix(JSON): Resolve mapping issues
  • Loading branch information
flytreeleft authored Apr 11, 2020
2 parents 1017fae + f427714 commit b3c0158
Showing 1 changed file with 5 additions and 0 deletions.
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

0 comments on commit b3c0158

Please sign in to comment.