From fecdf3b39a6edc1dfd6bac77abb28d0af1dcc14a Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Mon, 28 Apr 2025 21:30:09 -0400 Subject: [PATCH] fix: Make sure to only include models that use jsonSchema --- fetchModuleSchemas.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fetchModuleSchemas.js b/fetchModuleSchemas.js index 3c01a8d..f14535a 100644 --- a/fetchModuleSchemas.js +++ b/fetchModuleSchemas.js @@ -16,24 +16,30 @@ for (const module of modules) { if (module.tsp === "") continue const res = await fetch(module.tsp) let text = await res.text() + let last_line = '' text = text // add `...ModuleDefaults;` after the model type .split("\n") .flatMap(line => { if (line.trimStart().startsWith("model")) { - moduleModels.push(line.split(' ')[1]); + if (last_line.includes("@jsonSchema")) { + moduleModels.push(line.split(' ')[1]); + } + last_line = line return [ `@extension("additionalProperties", false)`, line ]; } if (line.trimStart().startsWith(`type: "${module.name}`)) { + last_line = line return [ line, '', ' ...ModuleDefaults; // added by fetchModuleSchemas.js', ]; } else { + last_line = line return line; } })