Skip to content

Added validation examples. #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
class="remove"
defer
></script>
<script class="remove"
src="https://cdn.jsdelivr.net/gh/digitalbazaar/[email protected]/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": "[email protected]"
},
"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">