|
8 | 8 | class="remove"
|
9 | 9 | defer
|
10 | 10 | ></script>
|
| 11 | + <script class="remove" |
| 12 | + src=" https://cdn.jsdelivr.net/gh/digitalbazaar/[email protected]/dist/main.js" ></script> |
11 | 13 | <script src="./common.js" class="remove"></script>
|
12 | 14 | <script class="remove">
|
13 | 15 | var respecConfig = {
|
|
61 | 63 | // postProcess: [restrictRefs],
|
62 | 64 | maxTocLevel: 2,
|
63 | 65 | inlineCSS: true,
|
| 66 | + postProcess: [window.respecVc.createVcExamples], |
64 | 67 | otherLinks: [{
|
65 | 68 | key: "Related Documents",
|
66 | 69 | data: [{
|
@@ -564,6 +567,124 @@ <h3>Evaluation</h3>
|
564 | 567 | <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>
|
565 | 568 | </ul>
|
566 | 569 | </p>
|
| 570 | + <p> |
| 571 | + Examples for the Success and Failure possible outcomes are provided below. |
| 572 | + </p> |
| 573 | + <pre class="example" title="Example Email JSON Schema"> |
| 574 | + { |
| 575 | + "$id": "https://example.com/schemas/email.json", |
| 576 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 577 | + "name": "EmailCredential", |
| 578 | + "description": "EmailCredential using JsonSchema", |
| 579 | + "type": "object", |
| 580 | + "properties": { |
| 581 | + "credentialSubject": { |
| 582 | + "type": "object", |
| 583 | + "properties": { |
| 584 | + "emailAddress": { |
| 585 | + "type": "string", |
| 586 | + "format": "email" |
| 587 | + } |
| 588 | + }, |
| 589 | + "required": [ |
| 590 | + "emailAddress" |
| 591 | + ] |
| 592 | + } |
| 593 | + } |
| 594 | + } |
| 595 | + </pre> |
| 596 | + <p> |
| 597 | + Validation according to the spec [[JSON-schema-2020-12]] yields Success when applying it to the VC below. |
| 598 | + </p> |
| 599 | + <pre class="example vc" title="Example Verifiable Credential - validations Success"> |
| 600 | + { |
| 601 | + "@context": [ |
| 602 | + "https://www.w3.org/ns/credentials/v2", |
| 603 | + "https://www.w3.org/ns/credentials/examples/v2" |
| 604 | + ], |
| 605 | + "id": "https://example.com/credentials/3732", |
| 606 | + "type": ["VerifiableCredential", "EmailCredential"], |
| 607 | + "issuer": "https://example.com/issuers/14", |
| 608 | + "issuanceDate": "2010-01-01T19:23:24Z", |
| 609 | + "credentialSubject": { |
| 610 | + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", |
| 611 | + "emailAddress": " [email protected]" |
| 612 | + }, |
| 613 | + "credentialSchema": { |
| 614 | + "id": "https://example.com/schemas/email.json", |
| 615 | + "type": "JsonSchema" |
| 616 | + } |
| 617 | + } |
| 618 | + </pre> |
| 619 | + <p> |
| 620 | + Validation according to the spec [[JSON-schema-2020-12]] yields Failure when applying it to the VC below. |
| 621 | + </p> |
| 622 | + <pre class="illegal-example vc" title="Example Verifiable Credential - validation Failure"> |
| 623 | + { |
| 624 | + "@context": [ |
| 625 | + "https://www.w3.org/ns/credentials/v2", |
| 626 | + "https://www.w3.org/ns/credentials/examples/v2" |
| 627 | + ], |
| 628 | + "id": "https://example.com/credentials/3732", |
| 629 | + "type": ["VerifiableCredential", "EmailCredential"], |
| 630 | + "issuer": "https://example.com/issuers/14", |
| 631 | + "issuanceDate": "2010-01-01T19:23:24Z", |
| 632 | + "credentialSubject": { |
| 633 | + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", |
| 634 | + "emailAddress": "not an email" |
| 635 | + }, |
| 636 | + "credentialSchema": { |
| 637 | + "id": "https://example.com/schemas/email.json", |
| 638 | + "type": "JsonSchema" |
| 639 | + } |
| 640 | + } |
| 641 | + </pre> |
| 642 | + <p> |
| 643 | + Assuming that the implementer does not support [[JSON-SCHEMA-2019-09]], an example of Indeterminate evaluation is provided below. |
| 644 | + </p> |
| 645 | + <pre class="example" title="Example Email JSON Schema using unsupported JSON Schema version"> |
| 646 | + { |
| 647 | + "$id": "https://example.com/schemas/email.json", |
| 648 | + "$schema": "https://json-schema.org/draft/2019-09/schema", |
| 649 | + "name": "EmailCredential", |
| 650 | + "description": "EmailCredential using JsonSchema", |
| 651 | + "type": "object", |
| 652 | + "properties": { |
| 653 | + "credentialSubject": { |
| 654 | + "type": "object", |
| 655 | + "properties": { |
| 656 | + "emailAddress": { |
| 657 | + "type": "string", |
| 658 | + "format": "email" |
| 659 | + } |
| 660 | + }, |
| 661 | + "required": [ |
| 662 | + "emailAddress" |
| 663 | + ] |
| 664 | + } |
| 665 | + } |
| 666 | + } |
| 667 | + </pre> |
| 668 | + <pre class="example vc" title="Example Verifiable Credential - validation Indeterminate"> |
| 669 | + { |
| 670 | + "@context": [ |
| 671 | + "https://www.w3.org/ns/credentials/v2", |
| 672 | + "https://www.w3.org/ns/credentials/examples/v2" |
| 673 | + ], |
| 674 | + "id": "https://example.com/credentials/3732", |
| 675 | + "type": ["VerifiableCredential", "EmailCredential"], |
| 676 | + "issuer": "https://example.com/issuers/14", |
| 677 | + "issuanceDate": "2010-01-01T19:23:24Z", |
| 678 | + "credentialSubject": { |
| 679 | + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", |
| 680 | + "emailAddress": "not an email" |
| 681 | + }, |
| 682 | + "credentialSchema": { |
| 683 | + "id": "https://example.com/schemas/email.json", |
| 684 | + "type": "JsonSchema" |
| 685 | + } |
| 686 | + } |
| 687 | + </pre> |
567 | 688 | </section>
|
568 | 689 | </section>
|
569 | 690 | <section class="informative">
|
|
0 commit comments