Skip to content

Extract method for manual_fields processing #5633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

carltongibson
Copy link
Collaborator

@carltongibson carltongibson commented Nov 28, 2017

Allows reuse of logic to replace Field instances in a field list by Field.name.

Adds a utility function for the logic plus a wrapper method on AutoSchema.

Closes #5632

TODO:

  • Add tests
  • Documentation

Allows reuse of logic to replace Field instances in a field list by `Field.name`.

Adds a utility function for the logic plus a wrapper method on `AutoSchema`.

Closes encode#5632
@carltongibson carltongibson added this to the v3.7.4 milestone Nov 28, 2017
@carltongibson
Copy link
Collaborator Author

carltongibson commented Nov 28, 2017

@rpkilby Can you just cast your eye over this please? General approach etc.

I'll add an explicit test on update_fields but beyond that I was happy to let the existing test cover the method level wrapper. Your thought there?

Ta.

Copy link
Member

@rpkilby rpkilby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened carltongibson#2 with suggestions.

* Use OrderedDict in inspectors

* Move empty check to 'update_fields()'

* Make 'update_fields()' an AutoSchema staticmethod

* Add 'AutoSchema.get_manual_fields()'

* Conform '.get_manual_fields()' to other methods
@carltongibson carltongibson dismissed rpkilby’s stale review December 1, 2017 09:11

Proposed changes merged. Thanks @rpkilby!

@carltongibson carltongibson force-pushed the 374/extract-manual-fields-logic branch from 865fc7d to 7dc903f Compare December 1, 2017 11:03
@carltongibson
Copy link
Collaborator Author

OK. I think this is ready to go.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes looks good to get in

@carltongibson carltongibson merged commit a0cdba6 into encode:master Dec 4, 2017
@carltongibson carltongibson deleted the 374/extract-manual-fields-logic branch December 4, 2017 08:07
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
* Extract method for `manual_fields` processing

Allows reuse of logic to replace Field instances in a field list by `Field.name`.

Adds a utility function for the logic plus a wrapper method on `AutoSchema`.

Closes encode#5632

* Manual fields suggestions (encode#2)

* Use OrderedDict in inspectors

* Move empty check to 'update_fields()'

* Make 'update_fields()' an AutoSchema staticmethod

* Add 'AutoSchema.get_manual_fields()'

* Conform '.get_manual_fields()' to other methods

* Add test for update_fields

* Make sure `manual_fields` is a list.

(As documented to be)

* Add docs for new AutoSchema methods.

* `get_manual_fields`
* `update_fields`

* Add release notes for PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants