add command to generate json schema#2996
Merged
dunglas merged 2 commits intoapi-platform:masterfrom Aug 21, 2019
Merged
Conversation
dunglas
requested changes
Aug 19, 2019
Member
dunglas
left a comment
There was a problem hiding this comment.
Almost good! Just one little more change. The CI must also be green (PHP CS Fixer, PHPStan etc).
dunglas
requested changes
Aug 19, 2019
1736836 to
4b9405d
Compare
49bb11d to
672949c
Compare
teohhanhui
reviewed
Aug 20, 2019
| ->setName('api:json-schema:generate') | ||
| ->setDescription('Generates the JSON Schema for a resource operation.') | ||
| ->addArgument('resource', InputArgument::REQUIRED, 'The Fully Qualified Class Name (FQCN) of the resource') | ||
| ->addOption('itemOperation', null, InputOption::VALUE_OPTIONAL, 'The item operation') |
Contributor
There was a problem hiding this comment.
All of the InputOption::VALUE_OPTIONAL should actually be InputOption::VALUE_REQUIRED.
From the documentation:
InputOption::VALUE_REQUIRED
This value is required (e.g. --iterations=5 or -i5), the option itself is still optional
Contributor
There was a problem hiding this comment.
Another thing, don't we usually use dashes in option names, not camelCase?
e9436f2 to
91b530e
Compare
teohhanhui
reviewed
Aug 20, 2019
| ->addOption('itemOperation', null, InputOption::VALUE_REQUIRED, 'The item operation') | ||
| ->addOption('collectionOperation', null, InputOption::VALUE_REQUIRED, 'The collection operation') | ||
| ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The response format', (string) $this->formats[0]) | ||
| ->addOption('type', null, InputOption::VALUE_REQUIRED, 'Use this option to set the type of output', 'input'); |
Contributor
There was a problem hiding this comment.
Perhaps:
The type of schema to generate (input or output)
45d4e9d to
8aef8bf
Compare
8aef8bf to
6ff741c
Compare
dunglas
approved these changes
Aug 21, 2019
Member
|
Thanks @jockos! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a command to generate a JSON Schema for a resource.
Can be used for the whole resource or by operation