Add json schema
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Aditya Thakral 2022-08-07 17:37:45 -07:00
parent c14455fe14
commit 2cbba93d9d
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Member list",
"description": "List of all members of the Computer Science Club of the University of Waterloo",
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "string"
},
"program": {
"type": "string"
}
}
}
}
}
}

View File

@ -7,7 +7,13 @@ async function createMembersApi() {
const { term, year } = getCurrentTermYear(); const { term, year } = getCurrentTermYear();
const members = await getMembers(year, term); const members = await getMembers(year, term);
await writeFile("public/api/members.json", JSON.stringify(members)); const result = {
$schema: "https://json-schema.org/draft/2020-12/schema",
$id: "schema/members.json",
members,
};
await writeFile("public/api/members.json", JSON.stringify(result));
} }
void createMembersApi(); void createMembersApi();