Skip to content

Comments

add command to generate json schema#2

Closed
jockos wants to merge 1 commit intodunglas:extract-schema-builderfrom
jockos:extract-schema-builder
Closed

add command to generate json schema#2
jockos wants to merge 1 commit intodunglas:extract-schema-builderfrom
jockos:extract-schema-builder

Conversation

@jockos
Copy link

@jockos jockos commented Aug 19, 2019

No description provided.

@jockos jockos force-pushed the extract-schema-builder branch from 6ad71d9 to ef09409 Compare August 19, 2019 13:43
</service>
<service id="ApiPlatform\Core\JsonSchema\SchemaFactoryInterface" alias="api_platform.json_schema.schema_factory" />

<service id="ApiPlatform\Core\JsonSchema\Command\JsonSchemaGenerateCommand" autoconfigure="true" autowire="true" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use autowiring nor autoconfigure yet in API Platform

*
* @author Jacques Lefebvre <jacques@les-tilleuls.coop>
*/
class JsonSchemaGenerateCommand extends Command
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class JsonSchemaGenerateCommand extends Command
final class JsonSchemaGenerateCommand extends Command

{
$this
->setName('api:json-schema:generate')
->setDescription('Generates the json schema for a resource operation.')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->setDescription('Generates the json schema for a resource operation.')
->setDescription('Generates the JSON Schema for a resource operation.')

->addArgument('resource', InputArgument::REQUIRED, 'The FQCN of the resource')
->addOption('itemOperation', null, InputOption::VALUE_OPTIONAL, 'The item operation')
->addOption('collectionOperation', null, InputOption::VALUE_OPTIONAL, 'The collection operation')
->addOption('format', null, InputOption::VALUE_OPTIONAL, 'The desired output format', 'json')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->addOption('format', null, InputOption::VALUE_OPTIONAL, 'The desired output format', 'json')
->addOption('format', null, InputOption::VALUE_OPTIONAL, 'The format of the response', 'json')

$operationName = null;

if ($itemOperation && $collectionOperation) {
throw new InvalidOptionException('If specified, only one operation type can be asked');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new InvalidOptionException('If specified, only one operation type can be asked');
throw new InvalidOptionException('You can only use one of "--itemOperation" and "--collectionOperation" options at the same time.');

@jockos jockos force-pushed the extract-schema-builder branch from ef09409 to a785929 Compare August 19, 2019 15:20
@jockos jockos force-pushed the extract-schema-builder branch from a785929 to 2a89a13 Compare August 19, 2019 16:22
@jockos jockos closed this Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants