diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-02 20:41:40 +1000 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-07-07 21:53:30 +0300 |
commit | 7d98ef972729c551822c290ad768aa5c35707e36 (patch) | |
tree | 981ba7bd07bb5102a38028a6a4a69690ca04cb05 /api/scripts | |
parent | Typescript-json-schema does not crawl extends (diff) | |
download | server-7d98ef972729c551822c290ad768aa5c35707e36.tar.xz |
Filter out schemas that block generation instead, and also include util in files
Diffstat (limited to 'api/scripts')
-rw-r--r-- | api/scripts/generate_schema.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/api/scripts/generate_schema.js b/api/scripts/generate_schema.js index 7e742ec1..b56c3fbc 100644 --- a/api/scripts/generate_schema.js +++ b/api/scripts/generate_schema.js @@ -27,7 +27,16 @@ const Excluded = [ "Response", "e.Response", "request.Response", - "supertest.Response" + "supertest.Response", + + // TODO: Figure out how to exclude schemas from node_modules? + "SomeJSONSchema", + "UncheckedPartialSchema", + "PartialSchema", + "UncheckedPropertiesSchema", + "PropertiesSchema", + "AsyncSchema", + "AnySchema", ]; function modify(obj) { @@ -39,11 +48,18 @@ function modify(obj) { } function main() { - const program = TJS.getProgramFromFiles(walk(path.join(__dirname, "..", "src", "routes")), compilerOptions); + const files = [ + ...walk(path.join(__dirname, "..", "src", "routes")), + ...walk(path.join(__dirname, "..", "..", "util", "src")), + ]; + const program = TJS.getProgramFromFiles( + files, + compilerOptions + ); const generator = TJS.buildGenerator(program, settings); if (!generator || !program) return; - const schemas = generator.getUserSymbols().filter((x) => (x.endsWith("Schema") || x.endsWith("Response")) && !Excluded.includes(x)); + let schemas = generator.getUserSymbols().filter((x) => (x.endsWith("Schema") || x.endsWith("Response")) && !Excluded.includes(x)); console.log(schemas); var definitions = {}; |