Github graphQL OrderBy

问题描述:

我有一个GraphQL查询。 我不明白为什么它不起作用。Github graphQL OrderBy

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

Link

你有一个错误

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

是的这是正确的答案。 –