@@ -368,9 +368,7 @@ def get_description(self, path, method):
368
368
else :
369
369
sections [current_section ] += '\n ' + line
370
370
371
- # TODO: coerce_method_names is used both here and by SchemaGenerator in
372
- # get_keys. It is read straight from the setting (i.e. it's not dynamic.)
373
- # ???: Can it be a module level constant (or callable)?
371
+ # TODO: SCHEMA_COERCE_METHOD_NAMES appears here and in `SchemaGenerator.get_keys`
374
372
coerce_method_names = api_settings .SCHEMA_COERCE_METHOD_NAMES
375
373
header = getattr (view , 'action' , method .lower ())
376
374
if header in sections :
@@ -518,11 +516,14 @@ def get_encoding(self, path, method):
518
516
519
517
return None
520
518
521
- # TODO: Where should this live?
522
- # - We import APIView here. So we can't import the descriptor into `views`
523
- # - APIView is only used by SchemaView.
524
- # - ???: Make `schemas` a package and move SchemaView to `schema.views`
525
- # - That way the schema attribute could be set in the class definition.
519
+ # Note: With `AutoSchema` defined we attach it to APIView.
520
+ # * We do this here to avoid the dependency cycle from SchemaView needing
521
+ # APIView (below).
522
+ # * This requires importing _something_ from `rest_framework.schemas` or
523
+ # `rest_framework.documentation` before `APIView.schema will be available.
524
+ # * ???: When would `APIView.schema` be needed and that NOT be the case?
525
+ # * The alternative is to import AutoSchema to `views`, make `schemas` a
526
+ # package, and move SchemaView to `schema.views`, importing APIView there.
526
527
APIView .schema = AutoSchema ()
527
528
528
529
0 commit comments