Skip to content

Commit

Permalink
generators: support custom ReferenceResolver class (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
pahaz authored and axnsan12 committed Jun 13, 2019
1 parent a083d3c commit 2656696
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/drf_yasg/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class OpenAPISchemaGenerator(object):
Method implementations shamelessly stolen and adapted from rest-framework ``SchemaGenerator``.
"""
endpoint_enumerator_class = EndpointEnumerator
reference_resolver_class = ReferenceResolver

def __init__(self, info, version='', url=None, patterns=None, urlconf=None):
"""
Expand Down Expand Up @@ -238,7 +239,7 @@ def get_schema(self, request=None, public=False):
:rtype: openapi.Swagger
"""
endpoints = self.get_endpoints(request)
components = ReferenceResolver(openapi.SCHEMA_DEFINITIONS, force_init=True)
components = self.reference_resolver_class(openapi.SCHEMA_DEFINITIONS, force_init=True)
self.consumes = get_consumes(api_settings.DEFAULT_PARSER_CLASSES)
self.produces = get_produces(api_settings.DEFAULT_RENDERER_CLASSES)
paths, prefix = self.get_paths(endpoints, components, request, public)
Expand Down

0 comments on commit 2656696

Please sign in to comment.