8000 OrderingFilter should expose camelCase fields · Issue #1008 · graphql-python/graphene-django · GitHub
[go: up one dir, main page]

Skip to content

OrderingFilter should expose camelCase fields #1008

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

Closed
lucas-bremond opened this issue Jul 22, 2020 · 0 comments · Fixed by #1054
Closed

OrderingFilter should expose camelCase fields #1008

lucas-bremond opened this issue Jul 22, 2020 · 0 comments · Fixed by #1054
Labels

Comments

@lucas-bremond
Copy link
Contributor
lucas-bremond commented Jul 22, 2020

Graphene Django's documentation on ordering exposes the orderBy filter:

query {
  group(id: "xxx") {
    users(orderBy: "-created_at") {
      createdAt
    }
  }
}

Since the created_at Django field is actually exposed in GraphQL as createdAt,
shouldn't the ordering filter follow a consistent style by default?

query {
  group(id: "xxx") {
    users(orderBy: "-createdAt") {
      createdAt
    }
  }
}

The workaround I've found is to do:

order_by = OrderingFilter(
  fields = (
    ('created_at', 'createdAt')
  )
)

but the casing conversion probably be handled by the framework itself, to avoid the unnecessary noise / maintenance bloat.

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

Successfully merging a pull request may close this issue.

1 participant
0