Skip to content

Commit

Permalink
refactor: modular schema registration
Browse files Browse the repository at this point in the history
  • Loading branch information
eyadmba committed Apr 4, 2024
1 parent 6d62ed3 commit f4a51a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/generate-register-schemas-function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ schemaDir="../src/schemas"
outputFile="../src/registerSchemas.ts"

# Write the fixed part of the template to the outputFile
echo "" > "$outputFile"
echo "// THIS FILE IS AUTOMATICALLY GENERATED!" >> "$outputFile"
echo "// THIS FILE IS AUTOMATICALLY GENERATED!" > "$outputFile"
echo "// using the script tools/generate-register-schemas-function.sh" >> "$outputFile"
echo "" >> "$outputFile"
echo "import Ajv from 'ajv';" >> "$outputFile"
Expand All @@ -35,7 +34,7 @@ for file in "$schemaDir"/*.json; do
importStatements+="import ${schemaName}Json from './schemas/${filename}';"$'\n'

# Create the ajvInstance.addSchema call
schemaCalls+=" ajvInstance.addSchema(${schemaName}Json);"$'\n'
schemaCalls+=" ajvInstance.addSchema(${schemaName}Json);"$'\n'
done

# Write the dynamic parts to the outputFile
Expand Down

0 comments on commit f4a51a8

Please sign in to comment.