Deferred schema renderer creation to avoid requiring pyyaml. (#6416)

Closes #6366.
This commit is contained in:
Carlton Gibson 2019-01-24 16:01:06 +01:00 committed by GitHub
parent f539c0dbd1
commit 8d20e10218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,8 +32,10 @@ class Command(BaseCommand):
self.stdout.write(output.decode('utf-8'))
def get_renderer(self, format):
return {
'corejson': CoreJSONRenderer(),
'openapi': OpenAPIRenderer(),
'openapi-json': JSONOpenAPIRenderer()
renderer_cls = {
'corejson': CoreJSONRenderer,
'openapi': OpenAPIRenderer,
'openapi-json': JSONOpenAPIRenderer,
}[format]
return renderer_cls()