summary refs log tree commit diff
path: root/api/scripts/generate_schema.js
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-09 14:16:15 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-09 14:16:15 +1000
commit5c1532c798ee5fe39e591d7baed6ee29a31b0882 (patch)
tree9f4d5ce1c01e1de582becfc01cbb0ce79c9d890b /api/scripts/generate_schema.js
parentAllow multiple attachments in messages (diff)
parentFilter out schemas that block generation instead, and also include util in files (diff)
downloadserver-5c1532c798ee5fe39e591d7baed6ee29a31b0882.tar.xz
Merge branch 'master' into feat/multiUploads
Diffstat (limited to 'api/scripts/generate_schema.js')
-rw-r--r--api/scripts/generate_schema.js22
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 = {};