Skip to content

Migrate to jackson 3 - #93

Merged
sspaink merged 3 commits into
open-policy-agent:mainfrom
sspaink:migrate-jackson-3
Oct 14, 2026
Merged

sspaink merged 3 commits into
open-policy-agent:mainfrom
sspaink:migrate-jackson-3

Conversation

@sspaink

@sspaink sspaink commented Jun 24, 2026 •

Copy link
Copy Markdown
Member

Migrate the SDK from Jackson 2.x (com.fasterxml.jackson.*) to Jackson 3.x (tools.jackson.*) so we can pick up com.networknt:json-schema-validator:3.0.5, which dropped its Jackson 2 line. #52

Swap the abandoned com.github.java-json-tools:json-patch for an inline RFC 6902 implementation in JsonBuiltins (no new dependency).

if (d != null && TypeUtils.isWholeNumberInLongRange(d)) {
gen.writeNumber(d.longValue());
} else {
gen.writeNumber(d);
@sspaink

sspaink commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Let's revisit this in the future, not required atm

@sspaink sspaink closed this Jul 14, 2026
@sspaink sspaink reopened this Oct 13, 2026
Move the SDK from Jackson 2.x (com.fasterxml.jackson.*) to Jackson 3.x
(tools.jackson.*) so we can pick up com.networknt:json-schema-validator
3.x, which dropped its Jackson 2 line.

Replace the abandoned com.github.java-json-tools:json-patch with an
inline RFC 6902 implementation in JsonBuiltins (no new dependency).

Jackson 3 behavior differences handled along the way:
- java.time support is built in, so jackson-datatype-jsr310 is dropped.
- Properties sort alphabetically by default; JacksonCapabilities opts
  out so capabilities.json keeps its declaration order.
- asString() throws on container nodes where asText() returned "", so
  json.patch path normalization uses asString("") to keep OPA parity.
- YAML parse errors now surface snakeyaml-engine's
  MarkedYamlEngineException, unwrapped for Go-style "yaml: line N" text.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>

@kroekle kroekle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude thinks that JsonBuiltins.java might be a little light on test coverage.

Overall the change seems to be backwards compatible, so LGTM

The upstream json-patch suite leaves gaps around the inline RFC 6902
engine: moving into an own child, the append token on remove/replace,
copy independence, escaped segments and signed indices. Expected values
come from opa eval against OPA 1.19.0.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
@sspaink
sspaink merged commit 71a7b1c into open-policy-agent:main Oct 14, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants