File tree Expand file tree Collapse file tree 4 files changed +131
-3
lines changed Expand file tree Collapse file tree 4 files changed +131
-3
lines changed Original file line number Diff line number Diff line change 13
13
"scripts" : {
14
14
"lint" : " npx eslint . --ext .ts" ,
15
15
"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 " ,
17
17
"test" : " npx hardhat test" ,
18
18
"test:coverage" : " npx nyc --reporter=html --reporter=lcov hardhat test"
19
19
},
Original file line number Diff line number Diff line change
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 ) ) ;
Original file line number Diff line number Diff line change 2
2
"extends" : " ./tsconfig.json" ,
3
3
"exclude" : [
4
4
" node_modules" ,
5
- " test/**/*"
5
+ " test/**/*" ,
6
+ " scripts"
6
7
]
7
8
}
Original file line number Diff line number Diff line change 19
19
"include" : [
20
20
" src" ,
21
21
" test"
22
- ],
22
+ , " scripts/responseSchema.ts " ],
23
23
"exclude" : [
24
24
" node_modules"
25
25
]
You can’t perform that action at this time.
0 commit comments