From 4b387bf8a3c29b3a82dcb94ac959ba7c3b28e166 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:01:46 +0000 Subject: [PATCH 1/2] build: bump com.networknt:json-schema-validator from 1.5.9 to 2.0.0 Bumps [com.networknt:json-schema-validator](https://github.com/networknt/json-schema-validator) from 1.5.9 to 2.0.0. - [Release notes](https://github.com/networknt/json-schema-validator/releases) - [Changelog](https://github.com/networknt/json-schema-validator/blob/master/CHANGELOG.md) - [Commits](https://github.com/networknt/json-schema-validator/compare/1.5.9...2.0.0) --- updated-dependencies: - dependency-name: com.networknt:json-schema-validator dependency-version: 2.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index febcb5e597..a4c21d1fdd 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ 1.7.0 5.0.15.RELEASE 9.4.11.v20180605 - 1.5.9 + 2.0.0 1.17.8 9.9 From 7c1aa8d9422b4ea497b30f434a5fca656f2869b8 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Nov 2025 10:44:29 +0100 Subject: [PATCH 2/2] migrate to 2.x API --- .../co/elastic/apm/agent/MockReporter.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java index 1241be6330..2809d91d25 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java @@ -37,10 +37,9 @@ import com.dslplatform.json.JsonWriter; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.networknt.schema.JsonSchema; -import com.networknt.schema.JsonSchemaFactory; -import com.networknt.schema.SpecVersion; -import com.networknt.schema.ValidationMessage; +import com.networknt.schema.Schema; +import com.networknt.schema.SchemaRegistry; +import com.networknt.schema.SpecificationVersion; import org.awaitility.core.ThrowingRunnable; import org.stagemonitor.configuration.ConfigurationRegistry; import specs.TestJsonSpec; @@ -384,7 +383,7 @@ public void verifyErrorSchema(JsonNode jsonNode) { } private void verifyJsonSchemas(Function serializerFunction, - Function schemaFunction, + Function schemaFunction, Function schemaPathFunction) { if (!verifyJsonSchema) { return; @@ -394,14 +393,13 @@ private void verifyJsonSchemas(Function serial String serializedString = serializerFunction.apply(schemaInstance.serializer); JsonNode jsonNode = asJson(serializedString); - JsonSchema schema = schemaFunction.apply(schemaInstance); + Schema schema = schemaFunction.apply(schemaInstance); verifyJsonSchema(jsonNode, schema, schemaPathFunction.apply(schemaInstance)); } } - private void verifyJsonSchema(JsonNode jsonNode, JsonSchema schema, String schemaPath) { - Set errors = schema.validate(jsonNode); - assertThat(errors) + private void verifyJsonSchema(JsonNode jsonNode, Schema schema, String schemaPath) { + assertThat(schema.validate(jsonNode)) .withFailMessage("%s\nJSON schema path = %s\n\n%s", errors, schemaPath, jsonNode.toPrettyString()) .isEmpty(); } @@ -777,11 +775,11 @@ private enum SchemaInstance { false); private final DslJsonSerializer.Writer serializer; - private final JsonSchema transactionSchema; + private final Schema transactionSchema; private final String transactionSchemaPath; - private final JsonSchema spanSchema; + private final Schema spanSchema; private final String spanSchemaPath; - private final JsonSchema errorSchema; + private final Schema errorSchema; private final String errorSchemaPath; SchemaInstance(String transactionSchema, String spanSchema, String errorSchema, boolean isLatest) { @@ -807,9 +805,9 @@ private enum SchemaInstance { this.serializer = new DslJsonSerializer(spyConfig, client, metaData).newWriter(); } - private static JsonSchema getSchema(String resource) { + private static Schema getSchema(String resource) { InputStream input = Objects.requireNonNull(MockReporter.class.getResourceAsStream(resource), "missing resource " + resource); - return JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4).getSchema(input); + return SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_4).getSchema(input); } }