encode/django-rest-framework (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Schema Generation: Extract Method for adjusting manual fields #5632

@carltongibson

Description

@carltongibson

Ref #5621 (comment)
Ref #5630

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

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