Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dump-schemaコマンドで指定したTypeのスキーマを出力するようにした #49

Merged
merged 1 commit into from
Jul 27, 2020
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
13 changes: 10 additions & 3 deletions Command/DumpSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
use GraphQL\Utils\SchemaPrinter;
use Plugin\Api\GraphQL\Schema;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DumpSchemaCommand extends Command
{
protected static $defaultName = 'eccube:api:dump-schema';

/**
* @var Schema
*/
Expand All @@ -38,12 +40,17 @@ public function __construct(Schema $schema)

protected function configure()
{
$this->setDescription('Dump GraphQL schema.');
$this->addArgument('type', InputArgument::OPTIONAL, 'Type name to dump schema')
->setDescription('Dump GraphQL schema.');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$x = SchemaPrinter::doPrint($this->schema);
$output->writeln($x);
$type = $input->getArgument('type');
if ($type) {
$output->writeln(SchemaPrinter::printType($this->schema->getType($type)));
} else {
$output->writeln(SchemaPrinter::doPrint($this->schema));
}
}
}