UNPKG

breathe-api

Version:

Model Context Protocol server for Breathe HR APIs with Swagger/OpenAPI support - also works with custom APIs

30 lines 951 B
import fs from 'fs/promises'; import path from 'path'; import { execFile } from 'child_process'; import { promisify } from 'util'; const exec = promisify(execFile); export async function generateRubyClient(parsed, config) { const specPath = path.join(config.outputDir, 'tmp-spec.json'); await fs.writeFile(specPath, JSON.stringify(parsed.spec, null, 2), 'utf-8'); await fs.mkdir(config.outputDir, { recursive: true }); try { await exec('npx', [ '-y', '@openapitools/openapi-generator-cli', 'generate', '-i', specPath, '-g', 'ruby', '-o', config.outputDir, '--skip-validate-spec', ]); } catch (error) { throw new Error(`openapi-generator failed: ${error}`); } await fs.unlink(specPath); return { ruby_client_generated: 'see outputDir' }; } //# sourceMappingURL=ruby.js.map