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')) self.stdout.write(output.decode('utf-8'))
def get_renderer(self, format): def get_renderer(self, format):
return { renderer_cls = {
'corejson': CoreJSONRenderer(), 'corejson': CoreJSONRenderer,
'openapi': OpenAPIRenderer(), 'openapi': OpenAPIRenderer,
'openapi-json': JSONOpenAPIRenderer() 'openapi-json': JSONOpenAPIRenderer,
}[format] }[format]
return renderer_cls()