From be3ebb1231129e479cf520c01a7401fccb7c329d Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Tue, 3 Oct 2023 10:43:00 -0400 Subject: [PATCH] Check criteria --- .../oneedtech/inspect/vc/probe/CredentialSubjectProbe.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/CredentialSubjectProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/CredentialSubjectProbe.java index b2c3494..37c917b 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/CredentialSubjectProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/CredentialSubjectProbe.java @@ -93,6 +93,11 @@ public class CredentialSubjectProbe extends Probe { } } } + // criteria must have id or narrative + JsonNode criteria = achievement.get("criteria"); + if (!criteria.has("id") && !criteria.has("narrative")) { + return error("criteria in achievement of credentialSubject must have id or narrative", ctx); + } } else if (achivementRequired) { return error("missing required achievement in credentialSubject", ctx); }