handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Unwrap Jackson2 Array and Object Nodes in JsonNodeValueResolver (#964, #969)

Open carusology opened this issue 3 years ago • 6 comments

Background

This is a fix for self-reported issue #964. Now the JsonNodeValueResolver resolves a Jackson2 ArrayNode as a List<Object> with its items being recursively resolved.

I wrote it in the same style as the JsonNodeValueResolver.toMap() method, meaning:

  • It uses a closure as a reference the original JsonNode.
  • It uses an abstract collection as the base implementation of the list.
  • It only implements the retrieval methods on the abstract collection.
  • It performs the recursive resolution lazily.

Testing

I wrote a few unit tests to verify the behavior works as expected. All of the existing unit tests pass without issue.

carusology avatar Apr 10 '22 17:04 carusology

@jknack: What do you think of this update to the JsonNodeValueResolver?

carusology avatar Apr 10 '22 17:04 carusology

Added a fix for #969 as well since it's basically the same problem but on JSON objects instead of JSON arrays. After a JSON object is converted to a Map<String, Object>, its entrySet() wasn't recursively resolving the value properties (Source).

I fixed it in a distinct commit following the same "lazy" pattern of resolution and added a test.

carusology avatar Apr 21 '22 19:04 carusology

( •_•)σ @jknack

Any objections? If not, is there a release guide? I don't mind going through the machinations.

carusology avatar May 11 '22 00:05 carusology

@jknack would we be able to get an update on this pull request or is there someone else who would be able to review these changes before they can be merged in?

mynameisjeoff avatar Aug 12 '22 02:08 mynameisjeoff

( •_•)σ @jknack

Any objections? If not, is there a release guide? I don't mind going through the machinations.

👋 I noticed you prepared the next release cycle, @jknack. Can this merge request be included?

carusology avatar Oct 24 '22 20:10 carusology