@@ -273,6 +273,8 @@ class SchemaGenerator(drf_openapi.SchemaGenerator):
273
273
def __init__ (self , * args , ** kwargs ):
274
274
self .openapi_schema = {}
275
275
super ().__init__ (* args , ** kwargs )
276
+ if not hasattr (self , 'check_duplicate_operation_id' ):
277
+ self .check_duplicate_operation_id = lambda paths : None
276
278
277
279
def get_schema (self , request = None , public = False ):
278
280
"""
@@ -453,6 +455,18 @@ def __init__(self, openapi_schema=None, **kwargs):
453
455
# TODO: shallow or deep merge?
454
456
self .openapi_schema = {** self .openapi_schema , ** jsonapi_ref }
455
457
458
+ # DRF >= 3.12 (not yet released) has changed a bunch of private methods to public.
459
+ # Accommodate those renamings for DRF < 3.12
460
+ # TODO: Since the DRF version string is not updated until after a release, for now,
461
+ # still need to check for it like this:
462
+ if not hasattr (self , 'get_path_parameters' ): # use this as a proxy for < 3.12
463
+ self .get_path_parameters = self ._get_path_parameters
464
+ self .get_pagination_parameters = self ._get_pagination_parameters
465
+ self .get_filter_parameters = self ._get_filter_parameters
466
+ self .get_components = lambda path , method : {} # no get_components for <= 3.12
467
+ self .map_field = self ._map_field
468
+ self .map_field_validators = self ._map_field_validators
469
+
456
470
def get_operation (self , path , method , action = None ):
457
471
""" basically a copy of AutoSchema.get_operation """
458
472
operation = {}
0 commit comments