diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/OB20Inspector.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/OB20Inspector.java index 3421ffd..dad41ef 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/OB20Inspector.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/OB20Inspector.java @@ -21,6 +21,7 @@ import org.oneedtech.inspect.util.json.ObjectMapperCache; import org.oneedtech.inspect.util.resource.Resource; import org.oneedtech.inspect.util.resource.ResourceType; import org.oneedtech.inspect.util.spec.Specification; +import org.oneedtech.inspect.vc.Assertion.Type; import org.oneedtech.inspect.vc.Credential.CredentialEnum; import org.oneedtech.inspect.vc.jsonld.JsonLdGeneratedObject; import org.oneedtech.inspect.vc.jsonld.probe.GraphFetcherProbe; @@ -151,18 +152,20 @@ public class OB20Inspector extends Inspector { } // verification and revocation - for(Probe probe : List.of(new VerificationDependenciesProbe(assertion.getId()), - new AssertionRevocationListProbe(assertion.getId()))) { - probeCount++; - accumulator.add(probe.run(jsonLdGeneratedObject, ctx)); - if(broken(accumulator)) return abort(ctx, accumulator, probeCount); - } + if (assertion.getCredentialType() == Type.Assertion) { + for(Probe probe : List.of(new VerificationDependenciesProbe(assertion.getId()), + new AssertionRevocationListProbe(assertion.getId()))) { + probeCount++; + accumulator.add(probe.run(jsonLdGeneratedObject, ctx)); + if(broken(accumulator)) return abort(ctx, accumulator, probeCount); + } - // JWS verification - if (assertion.getJwt().isPresent()) { - probeCount++; - accumulator.add(new VerificationJWTProbe(assertion.getJwt().get()).run(jsonLdGeneratedObject, ctx)); - if(broken(accumulator)) return abort(ctx, accumulator, probeCount); + // JWS verification + if (assertion.getJwt().isPresent()) { + probeCount++; + accumulator.add(new VerificationJWTProbe(assertion.getJwt().get()).run(jsonLdGeneratedObject, ctx)); + if(broken(accumulator)) return abort(ctx, accumulator, probeCount); + } } diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java index 1e13614..f4348f7 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java @@ -98,6 +98,16 @@ public class OB20Tests { }); } + @Test + void testLanguageInBadgeClass() { + assertDoesNotThrow(()->{ + Report report = validator.run(Samples.OB20.JSON.SIMPLE_LANGUAGE_BADGECLASS.asFileResource()); + if(verbose) PrintHelper.print(report, true); + assertValid(report); + // check than + }); + } + @Nested static class WarningTests { @BeforeAll diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java index 6de1cba..daabbaa 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java @@ -53,6 +53,8 @@ public class Samples { public final static Sample WARNING_ISSUER_NON_HTTPS_JSON = new Sample("ob20/warning-issuer-non-http.json", true); // original: test_validation: test_can_input_badgeclass public final static Sample SIMPLE_BADGECLASS = new Sample("ob20/assets/badgeclass1.json", true); + // original: validate_language: validate_language_prop_basic + public final static Sample SIMPLE_LANGUAGE_BADGECLASS = new Sample("ob20/badge-class-with-language.json", true); } public static final class PNG { diff --git a/inspector-vc/src/test/resources/ob20/badge-class-with-language.json b/inspector-vc/src/test/resources/ob20/badge-class-with-language.json new file mode 100644 index 0000000..36b8e2e --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/badge-class-with-language.json @@ -0,0 +1,10 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "id": "http://example.org/badgeclass", + "@language": "en-US", + "name": "Example Badge", + "description": "An example", + "criteria": "http://example.com/badgecriteria.json", + "issuer": "http://example.org/issuer1.json", + "type": "BadgeClass" +} \ No newline at end of file