Skip to content
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

Add enum support to filters and fix filter typing (v3) #1119

Merged
merged 2 commits into from
Feb 23, 2021

Conversation

tcleonard
Copy link
Collaborator

  • Add filtering support for choice fields converted to graphql Enum (or not)
  • Fix type of various filters (used to default to String)
  • Fix bug with contains introduced in previous PR
  • Fix bug with declared filters being overridden (see PR Only override non declared filters  #1108)
  • Fix support for ArrayField and add documentation
    103427653-58ec3a80-4b77-11eb-9543-775c9c208dbd

Thomas Leonard added 2 commits February 13, 2021 17:04
…or not)

- Fix type of various filters (used to default to String)
- Fix bug with contains introduced in previous PR
- Fix bug with declared filters being overridden (see PR graphql-python#1108)
- Fix support for ArrayField and add documentation
Copy link
Collaborator

@zbyte64 zbyte64 left a comment

Choose a reason for hiding this comment

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

Amazing work, just have the one question with regards to order_by

@@ -68,7 +87,7 @@ def filter_kwargs():
if k in filtering_args:
if k == "order_by" and v is not None:
v = to_snake_case(v)
kwargs[k] = v
kwargs[k] = convert_enum(v)
Copy link
Collaborator

@zbyte64 zbyte64 Feb 16, 2021

Choose a reason for hiding this comment

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

Does this mean order_by arguments can be an enum, or does this have any other impact?

Copy link
Collaborator Author

@tcleonard tcleonard Feb 16, 2021

Choose a reason for hiding this comment

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

no, order_by have to be strings since it is supposed to be the name of the field you want to order by (and to_snake_case only works for strings)
convert_enum method only transform Enums and leave other things untouched (so a string wouldn't get modified by the function)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants