Skip to content

@context items schema uses oneOf with two string branches — any string URL fails validation #633

@PatStLouis

Description

@PatStLouis

Problem:

The current schema for @context array items is:

"items": {                                                
  "oneOf": [
    { "type": "string", "description": "A map representing an object..." },
    { "type": "string", "description": "A NormalizedString that represents a URL..." }                               
  ]
}

Both oneOf branches are type: string with no additional constraints. Because oneOf requires exactly one branch to match, any string value (e.g. "https://www.w3.org/ns/credentials/v2") matches both branches simultaneously and is rejected by JSON Schema validators with:

▎ "valid under more than one of the schemas listed in the 'oneOf' keyword"

This means every conformant credential with a string URL in @context fails schema validation against the published OpenAPI spec.

Expected schema (@context items are either a string URL or an inline context object):

"items": {                                                                                                           
 "oneOf": [                                              
   {
     "type": "string",
     "minLength": 1
   },
   {
     "type": "object",
     "minProperties": 1,                                                                                            
     "propertyNames": {
       "type": "string",                                                                                            
       "minLength": 1                                    
     }
   }
 ]
}

Impact: Any automated conformance tool that validates responses against the published OpenAPI spec will incorrectly flag valid credentials as non-conformant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions