graphql-python / graphql-python/graphene-django

Not able to use camelCase in `orderBy` field

Open
#1,491 3 comments 0 reactions 0 assignees View on GitHub
🐛bug
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.

* **What is the current behavior?**

I execute a query with these arguments:
```
{
"first": 50,
"kind": "QXNzZXRLaW5kOjMzZGYxZmNhLWI0NTAtNDcyZS05ZmYzLWI5NzcxZmYxMzlkMZ==",
"after": null,
"search": null,
"orderBy": "fuelType"
}
```

and `fuelType` (which is `fuelType` as a JSON column in a Django DB)
gets converted to `fuel_type` before it reaches django's ORM.

The culprit is here: `/usr/local/lib/python3.11/site-packages/graphene_django/filter/fields.py (line: 99) resolve_queryset()`
On the version of graphene_django that I'm currently using (3.2.0).

![telegram-cloud-photo-size-1-4974392837344963747-y](https://github.com/graphql-python/graphene/assets/17239750/c0961078-482d-4a66-a0ae-67746f477659)

* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).

execute a query where `orderBy` has a value that is in `camelCase`

* **What is the expected behavior?**
I'd expect the naming convention not to cause such weird sorting behavior. (Or, at the least, give me an error telling me what is wrong and why I cannot use `camelCase`)

* **What is the motivation / use case for changing the behavior?**
Please either add errors or fix the bug

* **Please tell us about your environment:**

- Version:
- Platform:

graphene-django = "==3.2.0"

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.