Skip to content

Commit 1e59cf3

Browse files
committed
feat(org.id-resolver): added DID resolution response schema ./dist/responseSchema.json
1 parent bedc021 commit 1e59cf3

File tree

4 files changed

+131
-3
lines changed

4 files changed

+131
-3
lines changed

packages/resolver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"scripts": {
1414
"lint": "npx eslint . --ext .ts",
1515
"lint:fix": "npx eslint . --ext .ts --fix",
16-
"build": "rm -rf dist && npx tsc -p tsconfig-build.json",
16+
"build": "rm -rf dist && npx tsc -p tsconfig-build.json && npx ts-node ./scripts/responseSchema.ts > ./dist/responseSchema.json",
1717
"test": "npx hardhat test",
1818
"test:coverage": "npx nyc --reporter=html --reporter=lcov hardhat test"
1919
},
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
import { org } from '@windingtree/org.json-schema';
2+
3+
const responseSchema = {
4+
'$id': 'responseSchema.json',
5+
title: 'ORGiD DID Resolution Response',
6+
allOf: [
7+
{
8+
'$ref': '#/definitions/DidResponse'
9+
}
10+
],
11+
definitions: {
12+
DidResponse: {
13+
type: 'object',
14+
properties: {
15+
'@context': {
16+
'$ref': '#/definitions/ContextReference'
17+
},
18+
did: {
19+
'$ref': '#/definitions/DIDReference'
20+
},
21+
didDocument: {
22+
'$ref': '#/definitions/OrgJsonReference'
23+
},
24+
didResolutionMetadata: {
25+
'$ref': '#/definitions/DIDResolutionMetadata'
26+
},
27+
didDocumentMetadata: {
28+
'$ref': '#/definitions/DIDDocumentMetadata'
29+
}
30+
},
31+
required: [
32+
'@context',
33+
'did',
34+
'didDocument',
35+
'didResolutionMetadata',
36+
'didDocumentMetadata'
37+
]
38+
},
39+
DIDResolutionMetadata: {
40+
type: 'object',
41+
properties: {
42+
contentType: {
43+
type: 'string',
44+
enum: [
45+
'application/did+ld+json'
46+
]
47+
},
48+
retrieved: {
49+
type: 'string',
50+
format: 'date-time'
51+
},
52+
duration: {
53+
type: 'number'
54+
},
55+
resolverVersion: {
56+
type: 'string'
57+
},
58+
error: {
59+
type: 'string'
60+
}
61+
},
62+
required: [
63+
'contentType',
64+
'retrieved',
65+
'duration',
66+
'resolverVersion'
67+
]
68+
},
69+
DIDDocumentMetadata: {
70+
type: 'object',
71+
properties: {
72+
created: {
73+
type: 'string',
74+
format: 'date-time'
75+
},
76+
updated: {
77+
type: 'string',
78+
format: 'date-time'
79+
},
80+
deactivated: {
81+
type: 'string',
82+
format: 'date-time'
83+
},
84+
data: {
85+
'$ref': '#/definitions/OrgIdData'
86+
}
87+
}
88+
},
89+
OrgIdData: {
90+
type: 'object',
91+
properties: {
92+
tokenId: {
93+
type: 'string'
94+
},
95+
orgId: {
96+
type: 'string'
97+
},
98+
owner: {
99+
type: 'string'
100+
},
101+
orgJsonUri: {
102+
type: 'string'
103+
},
104+
delegates: {
105+
type: 'array',
106+
items: {
107+
type: 'string'
108+
}
109+
},
110+
created: {
111+
type: 'string'
112+
}
113+
},
114+
required: [
115+
'tokenId',
116+
'orgId',
117+
'owner',
118+
'orgJsonUri',
119+
'delegates',
120+
'created'
121+
]
122+
},
123+
...org.definitions
124+
}
125+
};
126+
127+
console.log(JSON.stringify(responseSchema, null, 2));

packages/resolver/tsconfig-build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "./tsconfig.json",
33
"exclude": [
44
"node_modules",
5-
"test/**/*"
5+
"test/**/*",
6+
"scripts"
67
]
78
}

packages/resolver/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"include": [
2020
"src",
2121
"test"
22-
],
22+
, "scripts/responseSchema.ts" ],
2323
"exclude": [
2424
"node_modules"
2525
]

0 commit comments

Comments
 (0)