mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
check tag_objects is list or tuple
This commit is contained in:
parent
58b2c921dd
commit
24d293f9bc
|
@ -29,10 +29,10 @@ class SchemaGenerator(BaseSchemaGenerator):
|
||||||
|
|
||||||
def __init__(self, title=None, url=None, description=None, patterns=None, urlconf=None, version=None,
|
def __init__(self, title=None, url=None, description=None, patterns=None, urlconf=None, version=None,
|
||||||
tag_objects: List[Dict] = None):
|
tag_objects: List[Dict] = None):
|
||||||
self.tag_objects = tag_objects
|
|
||||||
super().__init__(title, url, description, patterns, urlconf, version)
|
super().__init__(title, url, description, patterns, urlconf, version)
|
||||||
|
|
||||||
if tag_objects:
|
if tag_objects:
|
||||||
|
assert isinstance(tag_objects, (list, tuple)), 'tag_objects must be list of dict'
|
||||||
self.tag_objects = tag_objects
|
self.tag_objects = tag_objects
|
||||||
|
|
||||||
def get_info(self):
|
def get_info(self):
|
||||||
|
@ -115,7 +115,7 @@ class SchemaGenerator(BaseSchemaGenerator):
|
||||||
'paths': paths,
|
'paths': paths,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.tag_objects:
|
if hasattr(self, 'tag_objects'):
|
||||||
schema['tags'] = self.tag_objects
|
schema['tags'] = self.tag_objects
|
||||||
|
|
||||||
if len(components_schemas) > 0:
|
if len(components_schemas) > 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user