Skip to content

Commit d6c1c05

Browse files
build: bump com.networknt:json-schema-validator from 1.5.9 to 2.0.0 (#4302)
* 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](networknt/json-schema-validator@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] <support@github.com> * migrate to 2.x API --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com>
1 parent df81218 commit d6c1c05

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737
import com.dslplatform.json.JsonWriter;
3838
import com.fasterxml.jackson.databind.JsonNode;
3939
import com.fasterxml.jackson.databind.ObjectMapper;
40-
import com.networknt.schema.JsonSchema;
41-
import com.networknt.schema.JsonSchemaFactory;
42-
import com.networknt.schema.SpecVersion;
43-
import com.networknt.schema.ValidationMessage;
40+
import com.networknt.schema.Schema;
41+
import com.networknt.schema.SchemaRegistry;
42+
import com.networknt.schema.SpecificationVersion;
4443
import org.awaitility.core.ThrowingRunnable;
4544
import org.stagemonitor.configuration.ConfigurationRegistry;
4645
import specs.TestJsonSpec;
@@ -384,7 +383,7 @@ public void verifyErrorSchema(JsonNode jsonNode) {
384383
}
385384

386385
private void verifyJsonSchemas(Function<DslJsonSerializer.Writer, String> serializerFunction,
387-
Function<SchemaInstance, JsonSchema> schemaFunction,
386+
Function<SchemaInstance, Schema> schemaFunction,
388387
Function<SchemaInstance, String> schemaPathFunction) {
389388
if (!verifyJsonSchema) {
390389
return;
@@ -394,14 +393,13 @@ private void verifyJsonSchemas(Function<DslJsonSerializer.Writer, String> serial
394393
String serializedString = serializerFunction.apply(schemaInstance.serializer);
395394
JsonNode jsonNode = asJson(serializedString);
396395

397-
JsonSchema schema = schemaFunction.apply(schemaInstance);
396+
Schema schema = schemaFunction.apply(schemaInstance);
398397
verifyJsonSchema(jsonNode, schema, schemaPathFunction.apply(schemaInstance));
399398
}
400399
}
401400

402-
private void verifyJsonSchema(JsonNode jsonNode, JsonSchema schema, String schemaPath) {
403-
Set<ValidationMessage> errors = schema.validate(jsonNode);
404-
assertThat(errors)
401+
private void verifyJsonSchema(JsonNode jsonNode, Schema schema, String schemaPath) {
402+
assertThat(schema.validate(jsonNode))
405403
.withFailMessage("%s\nJSON schema path = %s\n\n%s", errors, schemaPath, jsonNode.toPrettyString())
406404
.isEmpty();
407405
}
@@ -777,11 +775,11 @@ private enum SchemaInstance {
777775
false);
778776

779777
private final DslJsonSerializer.Writer serializer;
780-
private final JsonSchema transactionSchema;
778+
private final Schema transactionSchema;
781779
private final String transactionSchemaPath;
782-
private final JsonSchema spanSchema;
780+
private final Schema spanSchema;
783781
private final String spanSchemaPath;
784-
private final JsonSchema errorSchema;
782+
private final Schema errorSchema;
785783
private final String errorSchemaPath;
786784

787785
SchemaInstance(String transactionSchema, String spanSchema, String errorSchema, boolean isLatest) {
@@ -807,9 +805,9 @@ private enum SchemaInstance {
807805
this.serializer = new DslJsonSerializer(spyConfig, client, metaData).newWriter();
808806
}
809807

810-
private static JsonSchema getSchema(String resource) {
808+
private static Schema getSchema(String resource) {
811809
InputStream input = Objects.requireNonNull(MockReporter.class.getResourceAsStream(resource), "missing resource " + resource);
812-
return JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4).getSchema(input);
810+
return SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_4).getSchema(input);
813811
}
814812
}
815813

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<version.ecs.logging>1.7.0</version.ecs.logging>
9898
<version.spring>5.0.15.RELEASE</version.spring>
9999
<version.jetty-server>9.4.11.v20180605</version.jetty-server>
100-
<version.json-schema-validator>1.5.9</version.json-schema-validator>
100+
<version.json-schema-validator>2.0.0</version.json-schema-validator>
101101
<!-- Byte Buddy and ASM must be kept in sync -->
102102
<version.byte-buddy>1.18.1</version.byte-buddy>
103103
<version.asm>9.9</version.asm>

0 commit comments

Comments
 (0)