From 71a9a7210cabceec22b6e1a063aba012140835b2 Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Tue, 22 Apr 2025 18:11:58 +0530 Subject: [PATCH] fix: oas CLI to convert Windows paths to unix (#12254) * fix: oas CLI to convert Windows paths to unix * Create tidy-pigs-heal.md * refactor: revert to isolate the issue * refactor: add back the change with logs * fix: remove external dependency --- .changeset/tidy-pigs-heal.md | 5 +++++ .../cli/oas/medusa-oas-cli/src/command-oas.ts | 22 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 .changeset/tidy-pigs-heal.md diff --git a/.changeset/tidy-pigs-heal.md b/.changeset/tidy-pigs-heal.md new file mode 100644 index 0000000000..12b1a51feb --- /dev/null +++ b/.changeset/tidy-pigs-heal.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa-oas-cli": patch +--- + +fix: oas CLI to convert Windows paths to unix diff --git a/packages/cli/oas/medusa-oas-cli/src/command-oas.ts b/packages/cli/oas/medusa-oas-cli/src/command-oas.ts index a012dbfbb9..3b8b222c03 100644 --- a/packages/cli/oas/medusa-oas-cli/src/command-oas.ts +++ b/packages/cli/oas/medusa-oas-cli/src/command-oas.ts @@ -179,14 +179,20 @@ async function getOASFromPaths( customBaseFile?: string ): Promise { console.log(`🔵 Gathering custom OAS`) - const gen = await swaggerInline(additionalPaths, { - base: - customBaseFile ?? path.resolve(basePath, "oas", "default.oas.base.yaml"), - format: ".json", - logger: (log) => { - console.log(log) - }, - }) + const gen = await swaggerInline( + additionalPaths.map((additionalPath) => { + return additionalPath.replace(/\\/g, "/") + }), + { + base: + customBaseFile ?? + path.resolve(basePath, "oas", "default.oas.base.yaml"), + format: ".json", + logger: (log) => { + console.log(log) + }, + } + ) return (await OpenAPIParser.parse(JSON.parse(gen))) as OpenAPIObject }