Schema Generation: Extract Method for adjusting manual fields (original) (raw)

Ref #5621 (comment)
Ref #5630

The logic to add/adjust manual_fields is currently inline in get_link:

django-rest-framework/rest_framework/schemas/inspectors.py

Lines 184 to 188 inc63e35c

if self._manual_fields is not None:
by_name = {f.name: f for f in fields}
for f in self._manual_fields:
by_name[f.name] = f
fields = list(by_name.values())

This should be extracted to a separate method so the logic can be re-used when users are overriding get_link