renderOpenApi = $renderOpenApi; parent::__construct(); } /** * Configures the dump command. */ protected function configure() { $this ->setDescription('Dumps documentation in OpenAPI JSON format') ->addOption('area', '', InputOption::VALUE_OPTIONAL, '', 'default') ->addOption('no-pretty', '', InputOption::VALUE_NONE, 'Do not pretty format output') ; } /** * @return int|void */ protected function execute(InputInterface $input, OutputInterface $output) { $area = $input->getOption('area'); $options = [ 'no-pretty' => $input->hasParameterOption(['--no-pretty']), ]; $docs = $this->renderOpenApi->render(RenderOpenApi::JSON, $area, $options); $output->writeln($docs, OutputInterface::OUTPUT_RAW); return 0; } }