Initial commit
This commit is contained in:
commit
56f2195962
14 changed files with 1121 additions and 0 deletions
31
generateInterfaces.ts
Normal file
31
generateInterfaces.ts
Normal 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,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue