From 4e4e4e5dc84e9d71ff26c46125c2580a266a587a Mon Sep 17 00:00:00 2001 From: Sam Gunaratne Date: Fri, 22 Aug 2025 11:31:02 -0600 Subject: [PATCH] Schema has been fixed, manual fix not required --- bin/build.js | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/bin/build.js b/bin/build.js index 2054f3b..baba3b2 100644 --- a/bin/build.js +++ b/bin/build.js @@ -5,34 +5,6 @@ const { spawn } = require('child_process'); const apisDir = path.join(process.cwd(), 'apis', 'cf'); const distDir = path.join(process.cwd(), 'dist'); -async function fixUnresolvedReferences(outputFile, apiVersionDir) { - try { - let content = await fs.readFile(outputFile, 'utf8'); - - // Fix references that still point to external files - const fixes = [ - { from: /\$ref: \.\.\/components\/schemas\/Job\.yaml/g, to: '#/components/schemas/Job' }, - { from: /\$ref: \.\.\/components\/schemas\/Link\.yaml/g, to: '#/components/schemas/Link' } - ]; - - let hasChanges = false; - for (const fix of fixes) { - if (fix.from.test(content)) { - console.log(`Fixing unresolved reference: ${fix.from.source} -> ${fix.to}`); - content = content.replace(fix.from, `$ref: ${fix.to}`); - hasChanges = true; - } - } - - if (hasChanges) { - await fs.writeFile(outputFile, content, 'utf8'); - console.log(`Fixed unresolved references in ${outputFile}`); - } - } catch (error) { - console.warn(`Warning: Failed to fix unresolved references in ${outputFile}:`, error.message); - } -} - function runCommand(command, args, options = {}) { return new Promise((resolve) => { const cmd = `${command} ${args.join(' ')}`; @@ -94,10 +66,6 @@ async function build() { promises.push(runCommand('redocly', ['bundle', 'openapi.yaml', '-o', path.resolve(outputFile)], { cwd: apiVersionDir }).then(async (result) => { - // Post-process the bundled file to fix any remaining unresolved references - if (result.code === 0) { - await fixUnresolvedReferences(outputFile, apiVersionDir); - } return result; }));