Skip to content

Commit b52e372

Browse files
committed
Adjust comments
1 parent eb1d5e5 commit b52e372

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

rest_framework/schemas.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,7 @@ def get_description(self, path, method):
368368
else:
369369
sections[current_section] += '\n' + line
370370

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`
374372
coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES
375373
header = getattr(view, 'action', method.lower())
376374
if header in sections:
@@ -518,11 +516,14 @@ def get_encoding(self, path, method):
518516

519517
return None
520518

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.
526527
APIView.schema = AutoSchema()
527528

528529

0 commit comments

Comments
 (0)