Nested query issue: 'There can be only one argument named "first"'
duncanawoods opened this issue · comments
I'm trying to obtain all issues organised by project and column.
If I execute a query with:
public class ProjectModel
{
public string Name;
public string Url;
public List<ColumnModel> Columns;
}
public class ColumnModel
{
public string Name;
public List<IssueModel> Issues;
}
public class IssueModel
{
public string Title;
}
var query = new Query()
.Repository(repo, owner)
.Projects()
.AllPages()
.Select(
project => new ProjectModel()
{
Name = project.Name,
Url = project.Url,
Columns = project
.Columns(null, null, null, null)
.AllPages()
.Select(
col => new ColumnModel()
{
Name = col.Name,
Issues = col
.Cards(null, null, null, null, null)
.AllPages()
.Select(
projectCard => projectCard
.Content
.Switch<IssueModel>(
when => when
.Issue(
issue => new IssueModel()
{
Title = issue.Title
})))
.ToList()
})
.ToList()
});
With the query as it stands above, I get the error:
By the time this query traverses to the cards connection, it is requesting up to 1,000,000 possible nodes which exceeds the maximum limit of 500,000.
Which is kind of annoying because it's an insane theoretical maximum. Anyway, if I try to limit the results with e.g. .Columns(10, null, null, null)
then I get:
There can be only one argument named "first"
Sorry if I am missing something.
I have resorted to raw graphql which has no problem with nested first
parameters.
var client = new GraphQLHttpClient("https://api.github.com/graphql");
client.DefaultRequestHeaders.Add("Authorization", $"bearer {token}");
client.DefaultRequestHeaders.Add("User-Agent", @"Mozilla/5.0 (Windows NT 10; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0");
var query = @"{
repository(owner: """ + owner + "\", name: \"" + repo + @""") {
projects(first: 4) {
nodes {
columns(first: 10) {
nodes {
name
cards(first: 100) {
nodes {
content {
__typename
... on Issue {
title
url
}
}
}
}
}
}
}
}
}
}";
var result = await client.SendQueryAsync(query);
I've also run into this issue. If the raw graphql works then there appears to be an issue with the client :(
var query = new Query()
.Repository(owner: Var("owner"), name: Var("name"))
.Select(r => new
{
r.Name,
r.Description,
PullRequests = r.PullRequests(null, null, null, null, null, null, null, null, null).AllPages().Select(p => new GitHubWorkItem
(
p.Number,
p.Title,
p.State) // MERGED, OPEN, or CLOSED)
).ToList(),
Issues = r.Issues(50, null, null, null, null, null, null, null).AllPages().Select(i => new GitHubWorkItem
(
i.Number,
i.Title,
i.State
)// CLOSED or OPEN)
).ToList()
}).Compile();