tamirsagi commented on code in PR #539: URL: https://github.com/apache/flink-kubernetes-operator/pull/539#discussion_r1121282661
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/diff/DiffResult.java: ########## @@ -59,18 +63,48 @@ public String toString() { return ""; } - final ToStringBuilder lhsBuilder = - new ToStringBuilder(left, ToStringStyle.SHORT_PREFIX_STYLE); - final ToStringBuilder rhsBuilder = - new ToStringBuilder(right, ToStringStyle.SHORT_PREFIX_STYLE); + final StringBuilder builder = new StringBuilder(); + builder.append(left.getClass().getSimpleName()).append("["); diffList.forEach( diff -> { - lhsBuilder.append(diff.getFieldName(), diff.getLeft()); - rhsBuilder.append(diff.getFieldName(), diff.getRight()); + try { + JsonNode before = + objectMapper.readTree( + objectMapper.writeValueAsString(diff.getLeft())); + JsonNode after = + objectMapper.readTree( + objectMapper.writeValueAsString(diff.getRight())); + JsonNode jsonDiff = JsonDiff.asJson(before, after); + jsonDiff.forEach( + row -> { Review Comment: IMHO, Extracting multiple lines within a loop to a well named method help others to understand the intention behind that piece of code. it makes the code smaller, help with debugging and error handling when needed. i.e , obj.forEach(x -> createDiffObject(x)) In that case there is another loop for every row, it would be nicer to have another small method which indicates the operation per row.(IMO) -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org