31 lines
No EOL
834 B
TypeScript
31 lines
No EOL
834 B
TypeScript
/*
|
|
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,
|
|
}); |