diff --git a/index.html b/index.html index 9e520e9..e6a9dac 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,8 @@ class="remove" defer ></script> + <script class="remove" + src="https://cdn.jsdelivr.net/gh/digitalbazaar/respec-vc@2.0.1/dist/main.js"></script> <script src="./common.js" class="remove"></script> <script class="remove"> var respecConfig = { @@ -61,6 +63,7 @@ // postProcess: [restrictRefs], maxTocLevel: 2, inlineCSS: true, + postProcess: [window.respecVc.createVcExamples], otherLinks: [{ key: "Related Documents", data: [{ @@ -564,6 +567,124 @@ <h3>Evaluation</h3> <li><b>Indeterminate</b> – The credential could not be validated. Implementers MUST return this outcome when they encounter a schema whose version they do not support.</li> </ul> </p> + <p> + Examples for the Success and Failure possible outcomes are provided below. + </p> + <pre class="example" title="Example Email JSON Schema"> + { + "$id": "https://example.com/schemas/email.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "name": "EmailCredential", + "description": "EmailCredential using JsonSchema", + "type": "object", + "properties": { + "credentialSubject": { + "type": "object", + "properties": { + "emailAddress": { + "type": "string", + "format": "email" + } + }, + "required": [ + "emailAddress" + ] + } + } + } + </pre> + <p> + Validation according to the spec [[JSON-schema-2020-12]] yields Success when applying it to the VC below. + </p> + <pre class="example vc" title="Example Verifiable Credential - validations Success"> + { + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "id": "https://example.com/credentials/3732", + "type": ["VerifiableCredential", "EmailCredential"], + "issuer": "https://example.com/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "emailAddress": "subject@example.com" + }, + "credentialSchema": { + "id": "https://example.com/schemas/email.json", + "type": "JsonSchema" + } + } + </pre> + <p> + Validation according to the spec [[JSON-schema-2020-12]] yields Failure when applying it to the VC below. + </p> + <pre class="illegal-example vc" title="Example Verifiable Credential - validation Failure"> + { + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "id": "https://example.com/credentials/3732", + "type": ["VerifiableCredential", "EmailCredential"], + "issuer": "https://example.com/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "emailAddress": "not an email" + }, + "credentialSchema": { + "id": "https://example.com/schemas/email.json", + "type": "JsonSchema" + } + } + </pre> + <p> + Assuming that the implementer does not support [[JSON-SCHEMA-2019-09]], an example of Indeterminate evaluation is provided below. + </p> + <pre class="example" title="Example Email JSON Schema using unsupported JSON Schema version"> + { + "$id": "https://example.com/schemas/email.json", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "name": "EmailCredential", + "description": "EmailCredential using JsonSchema", + "type": "object", + "properties": { + "credentialSubject": { + "type": "object", + "properties": { + "emailAddress": { + "type": "string", + "format": "email" + } + }, + "required": [ + "emailAddress" + ] + } + } + } + </pre> + <pre class="example vc" title="Example Verifiable Credential - validation Indeterminate"> + { + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "id": "https://example.com/credentials/3732", + "type": ["VerifiableCredential", "EmailCredential"], + "issuer": "https://example.com/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "emailAddress": "not an email" + }, + "credentialSchema": { + "id": "https://example.com/schemas/email.json", + "type": "JsonSchema" + } + } + </pre> </section> </section> <section class="informative">