Initial commit

This commit is contained in:
Oliver 2022-08-08 23:27:23 -06:00
commit 233c1c4da6
14 changed files with 1085 additions and 0 deletions

31
generateInterfaces.ts Normal file
View file

@ -0,0 +1,31 @@
/*
This file is a utility used by the build system to generate interfaces from the
Joi schemas, this file should be run by using:
make interfaces
whenever a schema in src/schemas is modified.
*/
import { convertFromDirectory } from "joi-to-typescript";
const defaultOptions = {
indentationChacters: `\t`,
treatDefaultedOptionalAsRequired: true,
typeOutputDirectory: "./src/types",
indexAllToRoot: false,
flattenTree: false,
fileHeader: `/*
This file was automatically generated by joi-to-typescript
Do not modify this file manually
*/`
};
// Generate the interfaces from schemas unrelated to any specific endpoint
convertFromDirectory({
schemaDirectory: `./src/schemas`,
...defaultOptions,
});
// Generate the interfaces for each endpoint
convertFromDirectory({
schemaDirectory: `./src/endpoints`,
...defaultOptions,
});