UNPKG

@redocly/cli

Version:

[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API g

25 lines 1.11 kB
import { blue, gray, yellow } from 'colorette'; import { writeFileSync } from 'node:fs'; import { HandledError, logger, stringifyYaml } from '@redocly/openapi-core'; export async function handleGenerateArazzo({ argv, config, version, collectSpecData, }) { const outputFile = argv['output-file'] || 'auto-generated.arazzo.yaml'; const options = { outputFile, descriptionPath: argv.descriptionPath, collectSpecData, version, config, }; try { const { generate } = await import('@redocly/respect-core'); logger.info(gray('\n Generating Arazzo description... \n')); const generatedArazzo = await generate(options); writeFileSync(outputFile, stringifyYaml(generatedArazzo)); logger.info('\n' + blue(`Arazzo description ${yellow(outputFile)} successfully generated.`) + '\n'); } catch (error) { throw new HandledError('\n' + '❌ Failed to generate Arazzo description. Check the output file path you provided, or the OpenAPI file content.'); } } //# sourceMappingURL=generate-arazzo.js.map