diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-02 10:55:17 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-02 10:55:17 +1000 |
commit | 218f71b82cca0451cbe20834283100cac234666c (patch) | |
tree | d6052ae996de9fc03884cb4692838eb09da439f2 /scripts/schema.js | |
parent | prettier (diff) | |
parent | Remove ALL fosscord mentions (diff) | |
download | server-218f71b82cca0451cbe20834283100cac234666c.tar.xz |
Merge branch 'master' into refactor/dev/connections
Diffstat (limited to 'scripts/schema.js')
-rw-r--r-- | scripts/schema.js | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/scripts/schema.js b/scripts/schema.js index be1a7a3f..2a19ea26 100644 --- a/scripts/schema.js +++ b/scripts/schema.js @@ -1,6 +1,6 @@ /* - Fosscord: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Fosscord and Fosscord Contributors + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -17,9 +17,11 @@ */ /* - Regenerates the `fosscord-server/assets/schemas.json` file, used for API/Gateway input validation. + Regenerates the `spacebarchat/server/assets/schemas.json` file, used for API/Gateway input validation. */ +/* eslint-env node */ + const path = require("path"); const fs = require("fs"); const TJS = require("typescript-json-schema"); @@ -91,9 +93,9 @@ function main() { if (!part) continue; // this is a hack. want some want to check if its a @column, instead - if (part.properties) - Object.keys(part.properties) - .filter((key) => + if (part.properties) { + for (let key in part.properties) { + if ( [ // BaseClass methods "toJSON", @@ -104,9 +106,31 @@ function main() { "recover", "reload", "assign", - ].includes(key), - ) - .forEach((key) => delete part.properties[key]); + ].includes(key) + ) { + delete part.properties[key]; + continue; + } + + // if (part.properties[key].anyOf) { + // const nullIndex = part.properties[key].anyOf.findIndex( + // (x) => x.type == "null", + // ); + // if (nullIndex != -1) { + // part.properties[key].nullable = true; + // part.properties[key].anyOf.splice(nullIndex, 1); + + // if (part.properties[key].anyOf.length == 1) { + // Object.assign( + // part.properties[key], + // part.properties[key].anyOf[0], + // ); + // delete part.properties[key].anyOf; + // } + // } + // } + } + } definitions = { ...definitions, [name]: { ...part } }; } |