From 8b3d3ecac5cff4897f95b2f9933e9ea7a0797b02 Mon Sep 17 00:00:00 2001 From: Pavel White Date: Tue, 16 Apr 2019 23:58:29 +0300 Subject: [PATCH] generators: support custom ReferenceResolver class --- src/drf_yasg/generators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drf_yasg/generators.py b/src/drf_yasg/generators.py index 324fd062..26ec987b 100644 --- a/src/drf_yasg/generators.py +++ b/src/drf_yasg/generators.py @@ -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): """ @@ -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)