strawberry-graphql / strawberry-django

Strawberry GraphQL Django extension
MIT License
391 stars 115 forks source link

Fix: ordering when dealing with camelCased field #430

Closed he0119 closed 7 months ago

he0119 commented 7 months ago

Description

I found that f.name.value at L110 is camelCase value while at L63 f.name is underscore value which makes sort_key function always return 0.

https://github.com/strawberry-graphql/strawberry-graphql-django/blob/c90a7907913188cb5b70ee74e3fbe4a1ead7c8a2/strawberry_django/ordering.py#L110 https://github.com/strawberry-graphql/strawberry-graphql-django/blob/c90a7907913188cb5b70ee74e3fbe4a1ead7c8a2/strawberry_django/ordering.py#L62-L65

Try to fix it by converting f.name to camelCase value, don't know if this is the right way to fix the bug (will f.name.value always be camelCase value?).

Types of Changes

Issues Fixed or Closed by This PR

https://github.com/strawberry-graphql/strawberry-graphql-django/issues/150#issuecomment-1835527261

Checklist