diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Assertion.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Assertion.java index 24d0b44..4493f2d 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Assertion.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Assertion.java @@ -1,5 +1,7 @@ package org.oneedtech.inspect.vc; +import static org.oneedtech.inspect.vc.util.PrimitiveValueValidator.validateIri; + import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -84,14 +86,21 @@ public class Assertion extends Credential { VerificationObject(List.of("VerificationObject")), VerificationObjectAssertion(List.of("VerificationObjectAssertion")), VerificationObjectIssuer(List.of("VerificationObjectIssuer")), + External(Collections.emptyList(), false), Unknown(Collections.emptyList()); public static List primaryObjects = List.of(Assertion, BadgeClass, Issuer, Profile, Endorsement); private final List allowedTypeValues; + private final boolean allowedTypeValuesRequired; Type(List typeValues) { + this(typeValues, true); + } + + Type(List typeValues, boolean allowedTypeValuesRequired) { this.allowedTypeValues = typeValues; + this.allowedTypeValuesRequired = allowedTypeValuesRequired; } public static Assertion.Type valueOf (JsonNode typeNode) { @@ -107,6 +116,12 @@ public class Assertion extends Credential { } } } + + // check external type + if (validateIri(typeNode)) { + return External; + } + return Unknown; } @@ -125,6 +140,11 @@ public class Assertion extends Credential { return List.of("https://w3id.org/openbadges/v2") ; } + @Override + public boolean isAllowedTypeValuesRequired() { + return allowedTypeValuesRequired; + } + public List getValidations() { return validationMap.get(this); } @@ -318,6 +338,8 @@ public class Assertion extends Credential { new Validation.Builder().name("startsWith").type(ValueType.URL).build(), new Validation.Builder().name("allowedOrigins").type(ValueType.URL_AUTHORITY).many(true).build() )) + .put(Type.External, Collections.emptyList()) + .put(Type.Unknown, Collections.emptyList()) .build(); public static final String ID = Assertion.class.getCanonicalName(); diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java index c7ba710..cebf818 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java @@ -90,6 +90,7 @@ public abstract class Credential extends GeneratedObject { public interface CredentialEnum { List getRequiredTypeValues(); List getAllowedTypeValues(); + boolean isAllowedTypeValuesRequired(); List getContextUris(); } diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VerifiableCredential.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VerifiableCredential.java index ba20cc2..2b29f9f 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VerifiableCredential.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/VerifiableCredential.java @@ -107,6 +107,10 @@ public class VerifiableCredential extends Credential { return allowedTypeValues; } + @Override + public boolean isAllowedTypeValuesRequired() { + return true; + } @Override public List getContextUris() { return contextMap.get(contextMap.keySet() diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java index 972427c..b53f5bd 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java @@ -31,12 +31,14 @@ public class TypePropertyProbe extends StringValuePropertyProbe { } } - List allowedValues = expected.getAllowedTypeValues(); - if (allowedValues.isEmpty()) { - return fatal("The type property is invalid", ctx); - } - if (!values.stream().anyMatch(v -> allowedValues.contains(v))) { - return fatal(formatMessage(values), ctx); + if (expected.isAllowedTypeValuesRequired()) { + List allowedValues = expected.getAllowedTypeValues(); + if (allowedValues.isEmpty()) { + return fatal("The type property is invalid", ctx); + } + if (!values.stream().anyMatch(v -> allowedValues.contains(v))) { + return fatal(formatMessage(values), ctx); + } } return success(ctx); 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 e95e668..b8eb96f 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 @@ -126,6 +126,29 @@ public class OB20Tests { }); } + @Test + void testRdfValidation() { + List.of(Samples.OB20.JSON.RDF_VALIDATION_VALID_BADGE_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_VALID_ISSUER_EXTENSION_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_VALID_ALIGNMENT_OBJECT, + Samples.OB20.JSON.RDF_VALIDATION_VALID_EXTERNAL_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_INVALID_EMPTY_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_INVALID_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_INVALID_ELEM_CLASS, + Samples.OB20.JSON.RDF_VALIDATION_INVALID_ISSUER_TYPE, + Samples.OB20.JSON.RDF_VALIDATION_VALID_EMPTY_CRITERIA_TYPE).forEach(resource -> { + assertDoesNotThrow(()->{ + Report report = validator.run(resource.asFileResource()); + if(verbose) PrintHelper.print(report, true); + if(resource.isValid()) { + assertValid(report); + } else { + assertInvalid(report); + } + }); + }); + } + @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 09ac1e7..fc2ccbc 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 @@ -59,6 +59,16 @@ public class Samples { public final static Sample ISSUER_COMPACTIRI_VALIDATION = new Sample("ob20/issuer-compact-iri-validation.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); + // original: test_validation: test_validate_in_context_string_type + public final static Sample RDF_VALIDATION_VALID_BADGE_CLASS = new Sample("ob20/rdf-validation/valid-badge-class.json", true); + public final static Sample RDF_VALIDATION_VALID_ISSUER_EXTENSION_CLASS = new Sample("ob20/rdf-validation/valid-issuer-extension.json", true); + public final static Sample RDF_VALIDATION_VALID_ALIGNMENT_OBJECT = new Sample("ob20/rdf-validation/valid-alignment-object.json", true); + public final static Sample RDF_VALIDATION_VALID_EXTERNAL_CLASS = new Sample("ob20/rdf-validation/valid-cool-class.json", true); + public final static Sample RDF_VALIDATION_INVALID_CLASS = new Sample("ob20/rdf-validation/invalid-class.json", false); + public final static Sample RDF_VALIDATION_INVALID_EMPTY_CLASS = new Sample("ob20/rdf-validation/invalid-empty-type.json", false); + public final static Sample RDF_VALIDATION_INVALID_ELEM_CLASS = new Sample("ob20/rdf-validation/invalid-one-invalid-class.json", false); + public final static Sample RDF_VALIDATION_INVALID_ISSUER_TYPE = new Sample("ob20/rdf-validation/badge-class-invalid-issuer-type.json", false); + public final static Sample RDF_VALIDATION_VALID_EMPTY_CRITERIA_TYPE = new Sample("ob20/rdf-validation/valid-badge-class-empty-criteria-type.json", true); } public static final class PNG { diff --git a/inspector-vc/src/test/resources/ob20/assets/criteria-no-type.json b/inspector-vc/src/test/resources/ob20/assets/criteria-no-type.json new file mode 100644 index 0000000..38b803a --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/assets/criteria-no-type.json @@ -0,0 +1,203 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "_:b0", + "narrative": "Do the important things." +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/assets/issuer-invalid-type.json b/inspector-vc/src/test/resources/ob20/assets/issuer-invalid-type.json new file mode 100644 index 0000000..402e76a --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/assets/issuer-invalid-type.json @@ -0,0 +1,203 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.org/issuer-invalid-type", + "type": "Criteria" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/badge-class-invalid-issuer-type.json b/inspector-vc/src/test/resources/ob20/rdf-validation/badge-class-invalid-issuer-type.json new file mode 100644 index 0000000..04031de --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/badge-class-invalid-issuer-type.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/issuer-invalid-type.json", + "type": "BadgeClass" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-class.json b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-class.json new file mode 100644 index 0000000..3efddad --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-class.json @@ -0,0 +1,204 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": "NotAKnownClass", + "name": "Chumley" + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-empty-type.json b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-empty-type.json new file mode 100644 index 0000000..d381011 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-empty-type.json @@ -0,0 +1,204 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": [], + "name": "Chumley" + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-one-invalid-class.json b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-one-invalid-class.json new file mode 100644 index 0000000..2109f08 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/invalid-one-invalid-class.json @@ -0,0 +1,204 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": ["Issuer", "UNKNOWN"], + "name": "Chumley" + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/valid-alignment-object.json b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-alignment-object.json new file mode 100644 index 0000000..9739292 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-alignment-object.json @@ -0,0 +1,206 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": "AlignmentObject", + "name": "Chumley", + "targetName": "target name", + "targetUrl": "http://example.com" + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class-empty-criteria-type.json b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class-empty-criteria-type.json new file mode 100644 index 0000000..03b6547 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class-empty-criteria-type.json @@ -0,0 +1,207 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": "BadgeClass", + "name": "Chumley", + "description": "An example", + "criteria": "http://example.com/criteria-no-type.json", + "issuer": "http://example.org/issuer1.json" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class.json b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class.json new file mode 100644 index 0000000..4a0cee7 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-badge-class.json @@ -0,0 +1,207 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": "BadgeClass", + "name": "Chumley", + "description": "An example", + "criteria": "http://example.com/badgecriteria.json", + "issuer": "http://example.org/issuer1.json" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/valid-cool-class.json b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-cool-class.json new file mode 100644 index 0000000..bf15347 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-cool-class.json @@ -0,0 +1,204 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": "http://example.com/CoolClass", + "name": "Chumley" + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/rdf-validation/valid-issuer-extension.json b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-issuer-extension.json new file mode 100644 index 0000000..139dac8 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/rdf-validation/valid-issuer-extension.json @@ -0,0 +1,206 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "extensions": "https://w3id.org/openbadges/extensions#", + "obi": "https://w3id.org/openbadges#", + "validation": "obi:validation", + "cred": "https://w3id.org/credentials#", + "dc": "http://purl.org/dc/terms/", + "schema": "http://schema.org/", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "AlignmentObject": "schema:AlignmentObject", + "CryptographicKey": "sec:Key", + "Endorsement": "cred:Credential", + "Assertion": "obi:Assertion", + "BadgeClass": "obi:BadgeClass", + "Criteria": "obi:Criteria", + "Evidence": "obi:Evidence", + "Extension": "obi:Extension", + "FrameValidation": "obi:FrameValidation", + "IdentityObject": "obi:IdentityObject", + "Image": "obi:Image", + "HostedBadge": "obi:HostedBadge", + "hosted": "obi:HostedBadge", + "Issuer": "obi:Issuer", + "Profile": "obi:Profile", + "RevocationList": "obi:RevocationList", + "SignedBadge": "obi:SignedBadge", + "signed": "obi:SignedBadge", + "TypeValidation": "obi:TypeValidation", + "VerificationObject": "obi:VerificationObject", + "author": { + "@id": "schema:author", + "@type": "@id" + }, + "caption": { + "@id": "schema:caption" + }, + "claim": { + "@id": "cred:claim", + "@type": "@id" + }, + "created": { + "@id": "dc:created", + "@type": "xsd:dateTime" + }, + "creator": { + "@id": "dc:creator", + "@type": "@id" + }, + "description": { + "@id": "schema:description" + }, + "email": { + "@id": "schema:email" + }, + "endorsement": { + "@id": "cred:credential", + "@type": "@id" + }, + "expires": { + "@id": "sec:expiration", + "@type": "xsd:dateTime" + }, + "genre": { + "@id": "schema:genre" + }, + "image": { + "@id": "schema:image", + "@type": "@id" + }, + "name": { + "@id": "schema:name" + }, + "owner": { + "@id": "sec:owner", + "@type": "@id" + }, + "publicKey": { + "@id": "sec:publicKey", + "@type": "@id" + }, + "publicKeyPem": { + "@id": "sec:publicKeyPem" + }, + "related": { + "@id": "dc:relation", + "@type": "@id" + }, + "startsWith": { + "@id": "http://purl.org/dqm-vocabulary/v1/dqm#startsWith" + }, + "tags": { + "@id": "schema:keywords" + }, + "targetDescription": { + "@id": "schema:targetDescription" + }, + "targetFramework": { + "@id": "schema:targetFramework" + }, + "targetName": { + "@id": "schema:targetName" + }, + "targetUrl": { + "@id": "schema:targetUrl" + }, + "telephone": { + "@id": "schema:telephone" + }, + "url": { + "@id": "schema:url", + "@type": "@id" + }, + "version": { + "@id": "schema:version" + }, + "alignment": { + "@id": "obi:alignment", + "@type": "@id" + }, + "allowedOrigins": { + "@id": "obi:allowedOrigins" + }, + "audience": { + "@id": "obi:audience" + }, + "badge": { + "@id": "obi:badge", + "@type": "@id" + }, + "criteria": { + "@id": "obi:criteria", + "@type": "@id" + }, + "endorsementComment": { + "@id": "obi:endorsementComment" + }, + "evidence": { + "@id": "obi:evidence", + "@type": "@id" + }, + "hashed": { + "@id": "obi:hashed", + "@type": "xsd:boolean" + }, + "identity": { + "@id": "obi:identityHash" + }, + "issuedOn": { + "@id": "obi:issueDate", + "@type": "xsd:dateTime" + }, + "issuer": { + "@id": "obi:issuer", + "@type": "@id" + }, + "narrative": { + "@id": "obi:narrative" + }, + "recipient": { + "@id": "obi:recipient", + "@type": "@id" + }, + "revocationList": { + "@id": "obi:revocationList", + "@type": "@id" + }, + "revocationReason": { + "@id": "obi:revocationReason" + }, + "revoked": { + "@id": "obi:revoked", + "@type": "xsd:boolean" + }, + "revokedAssertions": { + "@id": "obi:revoked" + }, + "salt": { + "@id": "obi:salt" + }, + "targetCode": { + "@id": "obi:targetCode" + }, + "uid": { + "@id": "obi:uid" + }, + "validatesType": "obi:validatesType", + "validationFrame": "obi:validationFrame", + "validationSchema": "obi:validationSchema", + "verification": { + "@id": "obi:verify", + "@type": "@id" + }, + "verificationProperty": { + "@id": "obi:verificationProperty" + }, + "verify": "verification" + }, + "id": "http://example.com/badge1", + "type": ["Issuer", "Extension"], + "name": "Chumley", + "url": "https://example.org", + "email": "contact@example.org" + } \ No newline at end of file