Skip to content

Commit

Permalink
Fix JSON Schema files to align with spec updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
decentralgabe authored and msporny committed Jun 9, 2024
1 parent a3cdff1 commit 3d2b13c
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 52 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ajv": "^8.11.0",
"assert": "^2.0.0",
"fs": "^0.0.1-security",
"mocha": "^10.1.0",
"mocha": "^10.4.0",
"yml2vocab": "^1.4.0"
},
"scripts": {
Expand Down
106 changes: 72 additions & 34 deletions schema/verifiable-credential/verifiable-credential-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"minProperties": 1
},
"refreshService": {
"credentialSchema": {
"type": "object",
"properties": {
"id": {
Expand All @@ -40,14 +40,46 @@
],
"additionalProperties": true
},
"termsOfUse": {
"credentialStatus": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/$defs/type"
}
},
"required": [
"id",
"type"
],
"additionalProperties": true
},
"refreshService": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/$defs/type"
}
},
"required": [
"id",
"type"
],
"additionalProperties": true
},
"termsOfUse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/$defs/type"
}
},
"required": [
Expand Down Expand Up @@ -147,10 +179,18 @@
"type": "string"
},
"type": {
"$ref": "#/$defs/type",
"contains": {
"const": "VerifiableCredential"
}
"oneOf": [
{
"type": "array",
"contains": {
"const": "VerifiableCredential"
}
},
{
"type": "string",
"enum": ["VerifiableCredential"]
}
]
},
"issuer": {
"oneOf": [
Expand All @@ -172,7 +212,12 @@
]
},
"validFrom": {
"type": "string"
"type": "string",
"pattern": "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"
},
"validUntil": {
"type": "string",
"pattern": "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"
},
"credentialSubject": {
"oneOf": [
Expand All @@ -188,40 +233,33 @@
}
]
},
"validUntil": {
"type": "string"
},
"credentialStatus": {
"type": "object",
"properties": {
"id": {
"type": "string"
"oneOf": [
{
"$ref": "#/$defs/credentialStatus"
},
"type": {
"$ref": "#/$defs/type"
{
"type": "array",
"items": {
"$ref": "#/$defs/credentialStatus"
},
"minItems": 1
}
},
"required": [
"id",
"type"
],
"additionalProperties": true
]
},
"credentialSchema": {
"type": "object",
"properties": {
"id": {
"type": "string"
"oneOf": [
{
"$ref": "#/$defs/credentialSchema"
},
"type": {
"$ref": "#/$defs/type"
{
"type": "array",
"items": {
"$ref": "#/$defs/credentialSchema"
},
"minItems": 1
}
},
"required": [
"id",
"type"
],
"additionalProperties": true
]
},
"refreshService": {
"oneOf": [
Expand Down
40 changes: 23 additions & 17 deletions schema/verifiable-presentation/verifiable-presentation-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
"description": "JSON Schema for a Verifiable Presentation according to the Verifiable Credentials Data Model v2",
"type": "object",
"$defs": {
"type": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minItems": 1
}
]
},
"proof": {
"type": "object",
"properties": {
"type": {
"$ref": "#/$defs/type"
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minItems": 1
}
]
},
"proofPurpose": {
"type": "string"
Expand Down Expand Up @@ -56,7 +53,8 @@
]
},
"created": {
"type": "string"
"type": "string",
"pattern": "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"
},
"domain": {
"type": "string"
Expand Down Expand Up @@ -96,10 +94,18 @@
"type": "string"
},
"type": {
"$ref": "#/$defs/type",
"contains": {
"const": "VerifiablePresentation"
}
"oneOf": [
{
"type": "array",
"contains": {
"const": "VerifiablePresentation"
}
},
{
"type": "string",
"enum": ["VerifiablePresentation"]
}
]
},
"verifiableCredential": {
"oneOf": [
Expand Down

0 comments on commit 3d2b13c

Please sign in to comment.