Skip to content

Commit

Permalink
Fix for DRF apps using deprecated CoreAPI schema (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimon authored Jul 19, 2024
1 parent 006d6c6 commit d00922b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apitally/django.py
Original file line number Diff line number Diff line change
@@ -252,7 +252,9 @@ def _get_drf_schema(urlconfs: List[Optional[str]]) -> Optional[Dict[str, Any]]:
from rest_framework.schemas.openapi import SchemaGenerator

schemas = []
with contextlib.suppress(AssertionError): # uritemplate and inflection must be installed for OpenAPI schema support
# AssertionError is raised if uritemplate or inflection are not installed (required for OpenAPI schema support)
# AttributeError is raised if app is using CoreAPI schema (deprecated) instead of OpenAPI
with contextlib.suppress(AssertionError, AttributeError):
for urlconf in urlconfs:
generator = SchemaGenerator(urlconf=urlconf)
schema = generator.get_schema()

0 comments on commit d00922b

Please sign in to comment.