From 299e7665ddcd6edf7ed0f7d1c8e2a973754c84ca Mon Sep 17 00:00:00 2001 From: Cihan Eran Date: Mon, 11 Jul 2022 17:54:20 +0300 Subject: [PATCH 1/2] Add --version CLI option to generateschema --- rest_framework/management/commands/generateschema.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rest_framework/management/commands/generateschema.py b/rest_framework/management/commands/generateschema.py index 024306b65f..0cc6953b2e 100644 --- a/rest_framework/management/commands/generateschema.py +++ b/rest_framework/management/commands/generateschema.py @@ -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('--version', dest="version", default='', type=str) def handle(self, *args, **options): if options['generator_class']: @@ -37,6 +38,7 @@ def handle(self, *args, **options): title=options['title'], description=options['description'], urlconf=options['urlconf'], + version=options['version'], ) schema = generator.get_schema(request=None, public=True) renderer = self.get_renderer(options['format']) From 4866960d84c4b7735e2206a8e12c0be4036ffef3 Mon Sep 17 00:00:00 2001 From: Cihan Eran Date: Wed, 21 Sep 2022 17:11:02 +0300 Subject: [PATCH 2/2] fix conflicting argument name --- rest_framework/management/commands/generateschema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/management/commands/generateschema.py b/rest_framework/management/commands/generateschema.py index 0cc6953b2e..8c73e4b9c8 100644 --- a/rest_framework/management/commands/generateschema.py +++ b/rest_framework/management/commands/generateschema.py @@ -26,7 +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('--version', dest="version", default='', type=str) + parser.add_argument('--api_version', dest="api_version", default='', type=str) def handle(self, *args, **options): if options['generator_class']: @@ -38,7 +38,7 @@ def handle(self, *args, **options): title=options['title'], description=options['description'], urlconf=options['urlconf'], - version=options['version'], + version=options['api_version'], ) schema = generator.get_schema(request=None, public=True) renderer = self.get_renderer(options['format'])