Skip to content

Commit

Permalink
Merge pull request #663 from jorgeecardona/add_patterns_to_apiview
Browse files Browse the repository at this point in the history
Keep the urlpatterns in the apiview and pass it to the generator
  • Loading branch information
tfranzel authored Feb 20, 2022
2 parents fb4f437 + bda07a2 commit 1e72618
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drf_spectacular/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SpectacularAPIView(APIView):
urlconf = spectacular_settings.SERVE_URLCONF
api_version = None
custom_settings = None
patterns = None

@extend_schema(**SCHEMA_KWARGS)
def get(self, request, *args, **kwargs):
Expand All @@ -72,7 +73,7 @@ def _get_schema_response(self, request):
# version specified as parameter to the view always takes precedence. after
# that we try to source version through the schema view's own versioning_class.
version = self.api_version or request.version or self._get_version_parameter(request)
generator = self.generator_class(urlconf=self.urlconf, api_version=version)
generator = self.generator_class(urlconf=self.urlconf, api_version=version, patterns=self.patterns)
return Response(
data=generator.get_schema(request=request, public=self.serve_public),
headers={"Content-Disposition": f'inline; filename="{self._get_filename(request, version)}"'}
Expand Down

0 comments on commit 1e72618

Please sign in to comment.