Skip to content

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

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
huanganqing opened this issue May 27, 2019 · 2 comments
Closed

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

huanganqing opened this issue May 27, 2019 · 2 comments

Comments

@huanganqing
Copy link

huanganqing commented May 27, 2019

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
        }
      ]
    }
  ]
}
@jnak
Copy link
Collaborator

jnak commented May 28, 2019

SQLAlchemyConnectionField expects a XXXConnection type. See tests.

@jnak jnak closed this as completed May 28, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants