Skip to content

Commit

Permalink
fix: JSON schema for W3CCredential (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored Dec 8, 2020
1 parent a4215e0 commit 543615f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/daf-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"qrcode-terminal": "^0.12.0",
"sqlite3": "^5.0.0",
"swagger-ui-express": "^4.1.4",
"ts-json-schema-generator": "^0.75.0",
"ts-json-schema-generator": "^0.80.0",
"typeorm": "0.2.24",
"url-parse": "^1.4.7",
"ws": "^7.2.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/daf-cli/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function createSchema(generator: TJS.SchemaGenerator, symbol: string) {
let fixedSymbol = symbol.replace('Array<', '').replace('>', '')

const schema = generator.createSchema(fixedSymbol)

if (fixedSymbol === 'ICreateVerifiableCredentialArgs') {
//@ts-ignore
schema.definitions['W3CCredential']['properties']['credentialSubject']['additionalProperties'] = true
}
// console.dir({ fixedSymbol, schema }, {depth: 10})

const newSchema = {
Expand Down
3 changes: 2 additions & 1 deletion packages/daf-w3c/plugin.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"id": {
"type": "string"
}
}
},
"additionalProperties": true
},
"credentialStatus": {
"type": "object",
Expand Down
31 changes: 21 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5138,11 +5138,16 @@ commander@^2.15.0, commander@^2.5.0, commander@^2.7.1, commander@^2.8.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==

commander@^6.1.0, commander@~6.1.0:
commander@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.1.0.tgz#f8d722b78103141006b66f4c7ba1e97315ba75bc"
integrity sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==

commander@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==

commander@~6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.0.0.tgz#2b270da94f8fb9014455312f829a1129dbf8887e"
Expand Down Expand Up @@ -7493,7 +7498,7 @@ fast-json-patch@^2.2.1:
dependencies:
fast-deep-equal "^2.0.1"

fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0:
fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
Expand Down Expand Up @@ -16586,16 +16591,17 @@ ts-json-schema-generator@^0.71.1:
json-stable-stringify "^1.0.1"
typescript "~4.0.2"

ts-json-schema-generator@^0.75.0:
version "0.75.0"
resolved "https://registry.yarnpkg.com/ts-json-schema-generator/-/ts-json-schema-generator-0.75.0.tgz#c52932548654620e77940346631b4a238e9c0438"
integrity sha512-TKsk/NAxK+44Tr3k1ldg1Fx1VhNVbHbmp0So9eXm7j7cGAtrLw5LlQYBHQIfj0eIT+RQxuuPFFpNyD7X2rm29w==
ts-json-schema-generator@^0.80.0:
version "0.80.0"
resolved "https://registry.yarnpkg.com/ts-json-schema-generator/-/ts-json-schema-generator-0.80.0.tgz#a106f93bab914199512ee2aa75caf903bb6a7245"
integrity sha512-NoHuSwTBlaRKGeDwprk/P5CCas1LnZbHnAo1Ff5LoPtySNzMO6M3citdBhwh4tBAcmQ/dNfQminvKzqlW+yXQw==
dependencies:
"@types/json-schema" "^7.0.6"
commander "~6.1.0"
glob "~7.1.6"
commander "^6.2.0"
fast-json-stable-stringify "^2.1.0"
glob "^7.1.6"
json-stable-stringify "^1.0.1"
typescript "~4.0.3"
typescript "~4.1.2"

ts-node@^8.6.2:
version "8.10.2"
Expand Down Expand Up @@ -16738,11 +16744,16 @@ typescript@^3.8.3, typescript@~3.9.5:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==

typescript@^4.0.3, typescript@~4.0.2, typescript@~4.0.3:
typescript@^4.0.3, typescript@~4.0.2:
version "4.0.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.3.tgz#153bbd468ef07725c1df9c77e8b453f8d36abba5"
integrity sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==

typescript@~4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==

uglify-js@^3.1.4:
version "3.11.1"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.11.1.tgz#32d274fea8aac333293044afd7f81409d5040d38"
Expand Down

0 comments on commit 543615f

Please sign in to comment.