generateschema: Add argument help text

This should make things a little clearer for anyone using this tool.
Some of this is taken from the OpenAPI specification itself [1].

[1] https://github.com/OAI/OpenAPI-Specification

Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
Stephen Finucane 2018-10-20 02:00:12 +01:00
parent a52692b5b1
commit db22aa41e0

View File

@ -14,13 +14,29 @@ class Command(BaseCommand):
help = "Generates configured API schema for project." help = "Generates configured API schema for project."
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--title') parser.add_argument(
parser.add_argument('--url') '--title',
parser.add_argument('--description') help='A short description of the application. CommonMark syntax '
parser.add_argument('--format', choices=['openapi', 'openapi-json', 'corejson'], default='openapi') 'MAY be used for rich text representation.')
parser.add_argument(
'--url',
help='A URL to the target host. This URL supports Server '
'Variables and MAY be relative, to indicate that the host '
'location is relative to the location where the OpenAPI document '
'is being served. Variable substitutions will be made when a '
'variable is named in {brackets}.')
parser.add_argument(
'--description',
help='An optional string describing the host designated by the '
'URL. CommonMark syntax MAY be used for rich text representation.')
parser.add_argument(
'--format',
choices=['openapi', 'openapi-json', 'corejson'], default='openapi',
help='Output format.')
parser.add_argument( parser.add_argument(
'output', 'output',
nargs='?', type=argparse.FileType('w'), default=sys.stdout) nargs='?', type=argparse.FileType('w'), default=sys.stdout,
help='Path to output file. If not specified, output to stdout')
def handle(self, *args, **options): def handle(self, *args, **options):
assert coreapi is not None, 'coreapi must be installed.' assert coreapi is not None, 'coreapi must be installed.'