Skip to content

OrderingFilter should expose camelCase fields #1008

@lucas-bremond

Description

@lucas-bremond

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions