Skip to content

Unknown argument "sort" on field "allEmployees" of type "Query" #219

@huanganqing

Description

@huanganqing

schema.py

  class Query(graphene.ObjectType):
       #node = relay.Node.Field()
       # Allow only single column sorting
       employee = relay.Node.Field(Employee)
       all_employees = SQLAlchemyConnectionField(
           Employee)
       # Allows sorting over multiple columns, by default over the primary key
       all_roles = SQLAlchemyConnectionField(Role)
       # Disable sorting over this field
       all_departments = SQLAlchemyConnectionField(Department, sort=None)

query from GraphiQL

{
  allEmployees(sort: [name_asc] ) {
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
    }
    edges {
      cursor
      node {
        id
        name
        department {
          name
        }
      }
    }
  }
}

The result from query would be:

{
  "errors": [
    {
      "message": "Unknown argument \"sort\" on field \"allEmployees\" of type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 16
        }
      ]
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions