Chore: update generateSchemas to work with current version

This commit is contained in:
Pieter Vander Vennet 2025-02-28 14:05:50 +01:00
parent 3319c516c9
commit 84df5b5624
4 changed files with 236 additions and 227 deletions

View file

@ -81,7 +81,7 @@ function WalkScheme<T>(
fullScheme = fullScheme ?? scheme
if (!skipRoot) {
let t = onEach(scheme, path)
const t = onEach(scheme, path)
if (t !== undefined) {
const isRequired = required?.indexOf(path.at(-1)) >= 0
results.push({
@ -385,7 +385,7 @@ function main() {
console.log("Trying to read", path)
let content = readFileSync(path, { encoding: "utf8" })
content = content.substring("export default ".length)
let parsed = JSON.parse(content)
const parsed = JSON.parse(content)
parsed["additionalProperties"] = false
for (const key in parsed.definitions) {

10
scripts/generateSchemas.sh Executable file
View file

@ -0,0 +1,10 @@
#! /bin/bash
for file in src/Models/ThemeConfig/Json/*Json.ts; do
echo "Processing $file"
filename=$(basename "$file" .${file##*.})
echo $filename
npx ts-json-schema-generator --unstable --no-top-ref -p $file > Docs/Schemas/$filename.schema.json
done