Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This project does not adhere to [Semantic Versioning](https://semver.org/) and m

### Added

- Pin public JSON/YAML mapper tree-deserializer delegation with regression tests and document the required checks for Jackson upgrades. [#1363](https://github.com/networknt/json-schema-validator/issues/1363)

### Changed

- Reduce decimal-preserving tree parser overhead by caching per token and avoiding text and decimal allocations for lossless floats. [#1362](https://github.com/networknt/json-schema-validator/issues/1362)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[Youtube](https://www.youtube.com/channel/UCHCRMWJVXw8iB7zKxF55Byw) |
[Documentation](https://doc.networknt.com/library/json-schema-validator/) |
[Contribution Guide](https://doc.networknt.com/contribute/) |
[Jackson Upgrade Checks](doc/jackson-upgrade-checks.md) |

[![CI](https://github.com/networknt/json-schema-validator/actions/workflows/ci.yml/badge.svg)](https://github.com/networknt/json-schema-validator/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/com.networknt/json-schema-validator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3Acom.networknt%20a%3Ajson-schema-validator)
Expand Down
52 changes: 52 additions & 0 deletions doc/jackson-upgrade-checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Jackson upgrade checks

See the [NetworkNT contribution guide](https://doc.networknt.com/contribute/) for
the general contribution workflow.

Re-verify `SelectiveTreeDeserializer` on **every Jackson dependency bump**, even
when the upgrade compiles without source changes. `JsonMapperFactory` and
`YamlMapperFactory` register this wrapper for `JsonNode`, `ObjectNode`, and
`ArrayNode`. It depends on Jackson's implementation-level `JsonNodeDeserializer`
factory and `DelegatingDeserializer` lifecycle, including contextualization,
null/absent handling, updates, and polymorphic type handling. Compilation alone
does not establish compatibility.

Run these commands from the repository root with the candidate Jackson version
set in `pom.xml`:

```sh
mvn -Dgroups=jackson-upgrade test
mvn verify
```

Keep the `jackson-upgrade` tag on these regression tests when renaming or moving
them, and apply it to new Jackson upgrade contracts.

Use the JDK matrix in the target branch's `.github/workflows/ci.yml`: Java
17/21/25 on `master` (Jackson 3), and Java 8/11/17/21 on `2.x` (Jackson 2).
Run each JDK sequentially in a checkout; builds share `target/`. Keep evidence
for the two branches separate. Record the Jackson/JDK versions, commands,
results, and any remaining remote CI gate in the PR. Do not exclude failing
tests to qualify an upgrade.

The `jackson-upgrade` JUnit-tagged suite exercises both public factory singletons
against an unmodified Jackson mapper of the same format. It checks declared tree root types, scalar
roots, null/empty/absent handling, update identity and nested merge behavior,
contextual merge overrides, per-reader number and error features, custom node
factories, decimal scale settings, polymorphic tree properties (including a
native subtype supplied by a custom module), error messages, source locations
and cause chains, and native
scalar/untyped/POJO binding. It deliberately retains Jackson's replacement
behavior for a property declared as generic `JsonNode`, even with `@JsonMerge`;
concrete `ObjectNode` and `ArrayNode` properties support in-place merging.

Lossy finite decimal promotion is the intentional difference from stock tree
reads. Those cases use explicit expected decimals and a stock reader with
`USE_BIG_DECIMAL_FOR_FLOATS` as the reference. Native scalar, `Object.class`, and
POJO binding must not acquire the selective tree policy. Other comparisons
include node classes, serialized shape, decimal scale, and signed-zero bits,
so matching numeric values alone cannot hide a representation change.

If a check fails after an upgrade, inspect the native Jackson behavior and the
wrapper separately. Revisit delegation and its configuration handling before
changing expected results; document any intentional compatibility change.
3 changes: 3 additions & 0 deletions src/test/java/com/networknt/schema/Issue1350ReviewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
package com.networknt.schema;

import static org.junit.jupiter.api.Assertions.*;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.stream.Stream;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -28,6 +30,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;

@Tag("jackson-upgrade")
class Issue1350ReviewTest {
static Stream<NodeReader> readers() {
return Stream.of(BasicNodeReader.getInstance(), NodeReader.builder().build(),
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/networknt/schema/Issue1350Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
package com.networknt.schema;

import static org.junit.jupiter.api.Assertions.*;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.networknt.schema.serialization.NodeReader;

@Tag("jackson-upgrade")
class Issue1350Test {
private static final String[] KEYWORDS = { "minItems", "maxItems", "minProperties", "maxProperties",
"minLength", "maxLength", "minContains", "maxContains" };
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/networknt/schema/Issue1357Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
package com.networknt.schema;

import static org.junit.jupiter.api.Assertions.*;

import java.io.ByteArrayInputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.stream.Stream;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -32,6 +34,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.networknt.schema.serialization.*;

@Tag("jackson-upgrade")
class Issue1357Test {
static Stream<NodeReader> readers() {
return Stream.of(BasicNodeReader.getInstance(), NodeReader.builder().build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import static org.junit.jupiter.api.Assertions.*;

import java.math.BigDecimal;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.json.JsonMapper;

@Tag("jackson-upgrade")
class Issue1362Test {
@Test
void optimizedAdvancementInvalidatesPrecision() throws Exception {
Expand Down
Loading
Loading