From f38c8fb8b33a705ed4eb4d2e0974060ebb88afd3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 9 Aug 2023 19:35:26 -0700 Subject: fix: :bug: another windows fix in typegen.js --- extension/scripts/typegen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extension/scripts') diff --git a/extension/scripts/typegen.js b/extension/scripts/typegen.js index ada39d47..8fec3888 100644 --- a/extension/scripts/typegen.js +++ b/extension/scripts/typegen.js @@ -4,7 +4,7 @@ const { compile } = require("json-schema-to-typescript"); function generateTypesForFile(inputPath, outputPath) { let schema = JSON.parse(fs.readFileSync(inputPath, "utf8")); - let name = (inputPath.split("/").pop() || inputPath).split(".")[0]; + let name = path.parse(path.basename(inputPath)).name; // This is to solve the issue of json-schema-to-typescript not supporting $ref at the top-level, which is what Pydantic generates for recursive types if ("$ref" in schema) { let temp = schema["$ref"]; -- cgit v1.2.3-70-g09d2