Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Fix generation when no configuration file is specified #61

Merged
merged 1 commit into from
Jul 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function configure()
{
$this->setName('generate');
$this->setDescription('Generate an api client: class, normalizers and resources given a specific Json OpenApi file');
$this->addOption('config-file', 'c', InputOption::VALUE_OPTIONAL, 'File to use for Jane OpenAPI configuration', '.jane-openapi');
$this->addOption('config-file', 'c', InputOption::VALUE_OPTIONAL, 'File to use for Jane OpenAPI configuration');
$this->addOption('reference', null, InputOption::VALUE_NONE, 'Use the JSON Reference specification in your generated library');
$this->addOption('date-format', 'd', InputOption::VALUE_OPTIONAL, 'Date time format to use for date time field');
$this->addArgument('openapi-file', InputArgument::OPTIONAL, 'Location of the OpenApi (Swagger) Schema file');
Expand All @@ -36,7 +36,15 @@ public function execute(InputInterface $input, OutputInterface $output)
{
$options = [];

if ($input->hasOption('config-file')) {
$configFile = null;

if (!$input->hasOption('config-file') && file_exists('.jane-openapi')) {
$configFile = '.jane-openapi';
} elseif($input->hasOption('config-file') && null !== $input->getOption('config-file')) {
$configFile = $input->getOption('config-file');
}

if ($configFile) {
$configFile = $input->getOption('config-file');

if (!file_exists($configFile)) {
Expand Down