Skip to content
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

orderby error #659

Closed
jimmyshen007 opened this issue Jan 18, 2019 · 2 comments
Closed

orderby error #659

jimmyshen007 opened this issue Jan 18, 2019 · 2 comments

Comments

@jimmyshen007
Copy link

jimmyshen007 commented Jan 18, 2019

Hi, experts, I just tried orderby feature, but got errors below. is that a known bug? Thanks for your help.

Query:

query Posts($orderby: [PostObjectsConnectionOrderbyInput],
  $status: PostStatusEnum
){
  posts(where: {status: $status, orderby: $orderby }){
    edges {
      node {
        id
      }
    }
  }
}

variables

{
  "orderby": {
    "field": "DATE",
    "order": "ASC"
  }
}

Error:

{
  "errors": [
    {
      "message": "Variable \"$orderby\" got invalid value {\"field\":\"DATE\",\"order\":\"ASC\"}.\nIn element #field: Expected \"PostObjectsConnectionOrderbyInput\", found not an object.\nIn element #order: Expected \"PostObjectsConnectionOrderbyInput\", found not an object.",
      "category": "graphql",
      "locations": [
        {
          "line": 29,
          "column": 13
        }
      ]
    }
  ]
}
@jasonbahl
Copy link
Collaborator

jasonbahl commented Jan 23, 2019

@jimmyshen007 hey, you just need to update your variables to be an array, since you're telling the query to expect a list of inputs

change to:

{
  "orderby": [
    {
      "field": "DATE",
      "order": "ASC"
    }
  ]
}

@jimmyshen007
Copy link
Author

Cool! Thanks Jason. works for me!

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

No branches or pull requests

2 participants