This specification defines a [[JsonSchema]] based credential schema validation scheme for use with the credential schema property of Verifiable Credentials

Credential Schema

Verifiable Credentials enable assurnace that the exchange of data between parties has occured without any tampering.

Issuers , Holders and Verifiers might want to exchange a credential schema by reference as part of a policy coordination or code sharing effort.

JSON Schema calls their specification versions "drafts" and publishes them by year, see [[JsonSchema]].

Open API Specification depends on [[JsonSchema]], see [[OAS]].

While both YAML and JSON are supported, implementations SHOULD use YAML for schemas that are meant to be read and edited by humans.

Per the guidance from yaml.org, implementations SHOULD use .yaml as the file extension.

JsonSchema

This term definition is https://www.w3.org/ns/credentials/issuer-dependent#JsonSchema.

JsonSchema is used for validation of W3C Verifiable Credentials, based on the latest version of the living standard.

An issuer MAY include a credentialSchema of type {{JsonSchema}}.

Example

JsonSchema2020

This term definition is https://www.w3.org/ns/credentials/issuer-dependent#JsonSchema2020.

JsonSchema2020 is for validation of W3C Verifiable Credentials, based on JSON Schema version 2020-12.

An issuer MAY include a credentialSchema of type {{JsonSchema2020}}.

        ...
        "credentialSchema": {
          "id": "https://vendor.example/schemas/credential.yaml",
          "type": "JsonSchema2020"
        }
        ...
              

A JSON Document complies with this specification if it follows the normative guidance in [[VC-DATA-MODEL]] and implements the associated version of [[!JsonSchema]] specified by the credential schema type property, as described in {{JsonSchema}} and {{JsonSchema2020}}.

Appendix

JSON-LD Processing

Due to the dependency on the W3C Verifiable Credentials @context, the following aliases are inherited.

Issuers might leverage @context to change term definitions, or the shape the RDF graph produced from [[JSON-LD]].

Command Line Example

This is how to valdiate a credential using ajv-validator/ajv-cli.