From 2f11941ebd66230f9be452fc2b59bbe4a1e6450b Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Mon, 28 Nov 2022 15:03:21 +0100 Subject: [PATCH] Pass node to reportForNonExistentProperty --- .../oneedtech/inspect/vc/probe/ContextPropertyProbe.java | 4 +++- .../java/org/oneedtech/inspect/vc/probe/PropertyProbe.java | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ContextPropertyProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ContextPropertyProbe.java index 8a21518..c6f9192 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ContextPropertyProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ContextPropertyProbe.java @@ -8,6 +8,8 @@ import org.oneedtech.inspect.core.probe.RunContext; import org.oneedtech.inspect.core.report.ReportItems; import org.oneedtech.inspect.vc.Credential.CredentialEnum; +import com.fasterxml.jackson.databind.JsonNode; + /** * A Probe that verifies a credential's context property. * @@ -23,7 +25,7 @@ public class ContextPropertyProbe extends StringValuePropertyProbe { } @Override - protected ReportItems reportForNonExistentProperty(RunContext ctx) { + protected ReportItems reportForNonExistentProperty(JsonNode node, RunContext ctx) { return notRun("No @context property", ctx); } diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/PropertyProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/PropertyProbe.java index ca64f9e..ed21f18 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/PropertyProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/PropertyProbe.java @@ -1,12 +1,10 @@ package org.oneedtech.inspect.vc.probe; -import java.util.List; import java.util.function.BiFunction; import org.oneedtech.inspect.core.probe.Probe; import org.oneedtech.inspect.core.probe.RunContext; import org.oneedtech.inspect.core.report.ReportItems; -import org.oneedtech.inspect.vc.util.JsonNodeUtil; import com.fasterxml.jackson.databind.JsonNode; @@ -28,14 +26,13 @@ public class PropertyProbe extends Probe { public ReportItems run(JsonNode root, RunContext ctx) throws Exception { JsonNode propertyNode = root.get(propertyName); if (propertyNode == null) { - return reportForNonExistentProperty(ctx); + return reportForNonExistentProperty(root, ctx); } - List values = JsonNodeUtil.asStringList(propertyNode); return validations.apply(propertyNode, ctx); } - protected ReportItems reportForNonExistentProperty(RunContext ctx) { + protected ReportItems reportForNonExistentProperty(JsonNode node, RunContext ctx) { return fatal("No " + propertyName + " property", ctx); }