fix: Add additionalProperties = false for schemas

This commit is contained in:
Gerald Pinder 2024-10-26 15:35:46 -04:00
parent 8b44a588a4
commit 08f1c4a9c3
2 changed files with 14 additions and 1 deletions

View file

@ -21,12 +21,18 @@ for (const module of modules) {
text = text // add `...ModuleDefaults;` after the model type
.split("\n")
.flatMap(line => {
if (line.trimStart().startsWith("model")) {
return [
`@extension("additionalProperties", false)`,
line
];
}
if (line.trimStart().startsWith(`type: "${module.name}"`)) {
return [
line,
'',
' ...ModuleDefaults; // added by fetchModuleSchemas.js',
]
];
} else {
return line;
}