kbendick commented on a change in pull request #4097:
URL: https://github.com/apache/iceberg/pull/4097#discussion_r807302709



##########
File path: core/src/main/java/org/apache/iceberg/util/JsonUtil.java
##########
@@ -49,6 +52,17 @@ public static ObjectMapper mapper() {
     return MAPPER;
   }
 
+  public static ObjectMapper withRESTComponents() {
+    RESTSerializers.registerAll(MAPPER);
+    // These are a workaround for Jackson since Iceberg doesn't use the 
standard get/set bean notation.
+    // This allows Jackson to work with the fields directly (both public and 
private) and not require
+    // custom (de)serializers for all the request/response objects.
+    MAPPER.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
+    MAPPER.setVisibility(PropertyAccessor.CREATOR, 
JsonAutoDetect.Visibility.ANY);  // deserialization
+    MAPPER.setVisibility(PropertyAccessor.FIELD, 
JsonAutoDetect.Visibility.ANY);  // serialization
+    return MAPPER;
+  }
+

Review comment:
       I didn't think we really came to a conclusion about removing these. I 
know we talked about removing annotations (`@JsonProperty`).
   
   The tests can definitely instantiate their own mappers, but without these 
somewhere we'll need to write out the Serializer / Deserializer for all of 
these (or make the fields public - which even then some mappers might be able 
to turn these off).
   
   I'll move these to the test classes for now though.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to