aboutsummaryrefslogtreecommitdiff
path: root/bin/checkPeople.js
diff options
context:
space:
mode:
Diffstat (limited to 'bin/checkPeople.js')
-rw-r--r--bin/checkPeople.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/checkPeople.js b/bin/checkPeople.js
index 3c564a4..877ba8f 100644
--- a/bin/checkPeople.js
+++ b/bin/checkPeople.js
@@ -1,4 +1,37 @@
const fs = require("fs");
+const Ajv = require("ajv");
+
+const ajv = new Ajv();
+
+const schema = {
+ type: "array",
+ uniqueItems: true,
+ minItems: 1,
+ items: {
+ type: "object",
+ required: ["name", "title", "entries"],
+ properties: {
+ github: {type: "string"},
+ name: {type: "string"},
+ title: {type: "string"},
+ entries: {
+ type: "array",
+ uniqueItems: true,
+ minItems: 1,
+ items: {
+ type: "object",
+ required: ["name", "link"],
+ properties: {
+ name: {type: "string"},
+ link: {type: "string"},
+ },
+ additionalProperties: false,
+ },
+ },
+ },
+ additionalProperties: false,
+ },
+};
const PEOPLE_PATH = "./people.json";
@@ -33,4 +66,10 @@ for (const entry of person.entries) {
}
}
+const validate = ajv.compile(schema);
+if (!validate(people)) {
+ console.error(validate.errors);
+ throw "people.json does not conform to json schema";
+}
+
console.log("Checked!");