2016-09-17 74 views
6

我有一個GraphQL查詢。 我不明白爲什麼它不起作用。Github graphQL OrderBy

{ 
    repositoryOwner(login: "Naramsim") { 
    login 
    repositories(first: 3, isFork: true, orderBy: {field: CREATED_AT}) { 
     edges { 
     node { 
      description 
     } 
     } 
    } 
    } 
} 

Link

回答

18

你有一個錯誤

Argument 'orderBy' on Field 'repositories' has an invalid value. 
Expected type 'RepositoryOrder'. 

您忘了指定被標記爲強制性的方向。這將工作:

{ 
    repositoryOwner(login: "Naramsim") { 
    login 
    repositories(first: 3, isFork: true, orderBy: {field: CREATED_AT, direction: ASC}) { 
     edges { 
     node { 
      description 
     } 
     } 
    } 
    } 
} 
+0

是的這是正確的答案。 –