-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate-people-json.js
40 lines (37 loc) · 1.14 KB
/
validate-people-json.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Copyright 2019 SME Virtual Network Contributors. All Rights Reserved.
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* This file was copied originally from the Microsoft Edge Status project:
*
* https://github.com/MicrosoftEdge/Status
*
* This file has been modified by the SME Virtual Network Contributors to test
* the open source project schema and list for SME Virtual Network projects.
* =============================================================================
*/
const ajv = require("ajv");
const validator = new ajv({
$data: true,
allErrors: true,
logger: false,
schemaId: "id",
useDefaults: true,
verbose: true
});
const schema = require("./brief-people.schema.json");
const peopleData = require("./people.json");
const validate = validator.compile(schema);
if (!validate(peopleData)) {
console.error(validate.errors);
process.exit(1);
} else {
process.exit(0);
}