Skip to content

Schema Verification Policy Reference

This reference documents the schema verification policy for the verifier service. The schema policy validates that credential content conforms to defined schemas, ensuring data integrity and structural correctness.

The schema verification policy validates the content of verifiable credentials against defined schemas to ensure the credential data adheres to expected structure and data types. This validation ensures credentials contain properly formatted data and helps maintain interoperability between different systems.

The schema verification policy supports credential schema validation across multiple standards:

StandardOrganizationSpecificationSchema FormatValidation Aspect
JSON SchemaIETFJSON SchemaJSON SchemaProvides underlying schema validation technology for credential data
JSON-LD Context ValidationW3CJSON-LD 1.1JSON-LD ContextValidates against semantic data models defined in JSON-LD contexts
SD-JWT Verifiable CredentialIETFSD-JWT DraftJWT ClaimsValidates JWT and SD-JWT claims against defined schemas
Verifiable Credentials JSON SchemaW3CVC JSON SchemaJSON SchemaValidates credential claims against standard JSON Schema

The verifier supports the following credential schema validation implementations:

Schema FormatDescriptionSpecificationBest For
W3C Verifiable Credential SchemaSchema validation for W3C VCsW3C RecommendationW3C VC validation using JSON Schema or JSON-LD Context
IETF Digital Credential SchemaSchema validation for IETF credentialsIETF DraftSD-JWT and JWT credential validation
flowchart TD
    subgraph "Schema Verification"
        Input[Credential] --> ExtractType[Extract Credential Type]
        ExtractType --> ResolveSchema[Resolve Schema]
        ResolveSchema --> ValidateContent[Validate Credential Content]
        ValidateContent --> Decision{Schema Valid?}
        Decision -->|Yes| Valid[Valid]
        Decision -->|No| Invalid[Invalid Schema]
    end

    SchemaRegistry[Schema Registry] -.-> |"Schema Retrieval"| ResolveSchema

    style Input fill:#f9f9f9,stroke:#333,stroke-width:1px
    style ExtractType fill:#e1f5fe,stroke:#333,stroke-width:1px
    style ResolveSchema fill:#e1f5fe,stroke:#333,stroke-width:1px
    style ValidateContent fill:#e1f5fe,stroke:#333,stroke-width:1px
    style Decision fill:#e1f5fe,stroke:#333,stroke-width:1px
    style Valid fill:#dcedc8,stroke:#333,stroke-width:1px
    style Invalid fill:#ffcdd2,stroke:#333,stroke-width:1px
    style SchemaRegistry fill:#fff9c4,stroke:#333,stroke-width:1px

When verifying against schemas, the policy follows these steps:

  1. Type extraction - Identifies the credential type and associated schema
  2. Schema resolution - Retrieves the schema from a schema registry or URI
  3. Content validation - Validates the credential data against the schema
  4. Result determination - Returns the validation result with any schema violations

The schema policy integrates with schema registry services to:

  1. Discover schemas based on credential types
  2. Fetch schema definitions from URIs
  3. Cache frequently used schemas for improved performance
  4. Support versioned schemas for credential evolution

The schema policy returns specific errors for various validation failures:

Error TypeDescriptionTypical Cause
Schema Not FoundCannot locate schema for validationMissing or invalid schema reference
Schema Resolution ErrorError retrieving schema from URINetwork issues or invalid schema URI
Validation ErrorCredential fails to validate against schemaMalformed credential data
Invalid SchemaSchema definition is invalidPoorly structured schema
Unsupported Schema TypeSchema format not supportedSchema uses unsupported validation mechanism

The schema verification policy offers various configuration options that control its behavior, including:

  • Enabling or disabling schema validation
  • Configuring schema resolution mechanisms
  • Setting validation behavior for missing schemas
  • Controlling error handling for validation failures
  • Schema caching settings

For detailed configuration options, parameters, and default values, see the Verifier Configuration Reference.