Skip to content

Commit

Permalink
Add --api-version CLI option to generateschema (encode#8663)
Browse files Browse the repository at this point in the history
* Add --version CLI option to generateschema

* fix conflicting argument name
  • Loading branch information
erancihan authored and sigvef committed Dec 3, 2022
1 parent 0c40837 commit 045fd9c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rest_framework/management/commands/generateschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def add_arguments(self, parser):
parser.add_argument('--urlconf', dest="urlconf", default=None, type=str)
parser.add_argument('--generator_class', dest="generator_class", default=None, type=str)
parser.add_argument('--file', dest="file", default=None, type=str)
parser.add_argument('--api_version', dest="api_version", default='', type=str)

def handle(self, *args, **options):
if options['generator_class']:
Expand All @@ -37,6 +38,7 @@ def handle(self, *args, **options):
title=options['title'],
description=options['description'],
urlconf=options['urlconf'],
version=options['api_version'],
)
schema = generator.get_schema(request=None, public=True)
renderer = self.get_renderer(options['format'])
Expand Down

0 comments on commit 045fd9c

Please sign in to comment.