Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow validation #64

Merged
merged 2 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:

- name: Install dependencies
run: cd viewer && npm ci

#TODO: we are not validating the schemas of the data files yet.
# - name: Validate
# run: cd viewer && npm run validate

- name: Validate
run: cd viewer && npm run validate

build:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions viewer/scripts/validate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const ajv = new Ajv({allowUnionTypes: true});
addFormats(ajv);
const profileSIGSchema = await axios.get('https://openwallet-foundation.github.io/credential-format-comparison-sig/assets/schemas/fields.json').then(res => res.data);
ajv.addSchema(profileSIGSchema, "https://openwallet-foundation.github.io/credential-format-comparison-sig/assets/schemas/fields.json");
const validate = ajv.compile(JSON.parse(readFileSync('../schema.json')));
const validate = ajv.compile(JSON.parse(readFileSync('src/assets/schema.json')));
const files = readdirSync('../wallets');
let success = true;
files.map(file => {
const wallet = JSON.parse(readFileSync(`../wallets/${file}`))
if(!validate(wallet)) {
console.error(`Error validating ${file}:`);
console.error(validate.errors);
console.error(JSON.stringify(validate.errors, null, 2));
success = false;
}
});
Expand Down
2 changes: 1 addition & 1 deletion viewer/src/app/wallets-add/wallets-add.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class WalletsAddComponent implements OnInit {

getJSON() {
return JSON.stringify(
{ ...this.form.value, $schema: '../schema.json' },
{ ...this.form.value, $schema: '../viewer/src/assets/schema.json' },
null,
2
);
Expand Down
1 change: 1 addition & 0 deletions wallets/Altme.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"capability": ["holder"],
"company": "Talao",
"contact": "[email protected]",
"urlWebsite": "https://altme.io/",
"credentialProfiles": ["EBSI"],
"downloadSource": "https://github.com/TalaoDAO/AltMe",
"license": "Apache 2.0",
Expand Down
7 changes: 3 additions & 4 deletions wallets/hightrust.id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"name": "hightrust.id",
"logo": "https://raw.githubusercontent.com/megical/hightrust.id-assets/main/AppIcons/hitid-app-icon-1024.png",
"company": "Megical Oy",
"CompanyUrl": "https://www.hightrust.id",
"urlWebsite": "https://www.hightrust.id",
"type": "edge",
"openSource": false,
"license": "Commercial software license",
"capability": [],
"portability": null,
"linkToApp": "",
"portability": false,
"credentialProfiles": [],
"credentialFormats": [],
"issuanceProtocols": [],
Expand All @@ -17,5 +16,5 @@
"signingAlgorithms": [],
"statusManagements": [],
"trustManagements": [],
"$schema": "../schema.json"
"$schema": "../viewer/src/assets/schema.json"
}