atulmy/gql-query-builder

Fields data object

Closed this issue · 1 comments

I try to send de query but send me an error

Query:
{
metrics {
id
name
paginatorInfo{
count
currentPage
firstItem
hasMorePages
lastItem
lastPage
perPage
total
}
}
}

image

Correct query:
{
metrics {
data {
id
name
}
paginatorInfo{
count
currentPage
firstItem
hasMorePages
lastItem
lastPage
perPage
total
}
}
}
Need put fields into object named "data {}", how can make if??

image

I try to send de query but send me an error

Query: { metrics { id name paginatorInfo{ count currentPage firstItem hasMorePages lastItem lastPage perPage total } } }

image

Correct query: { metrics { data { id name } paginatorInfo{ count currentPage firstItem hasMorePages lastItem lastPage perPage total } } } Need put fields into object named "data {}", how can make if??

image

Solve using CustomQueryAdapter
Add data to put into object
private operationTemplate(variables: VariableOptions | undefined) {
return ${this.operation} { data ${variables ? Utils.queryDataNameAndArgumentMap(variables) : ""} ${this.fields && this.fields.length > 0 ? "{ " + Utils.queryFieldsMap(this.fields) + " }" : ""} };
}