[GH-ISSUE #67] Fields data object #40

Closed
opened 2026-03-03 00:02:55 +03:00 by kerem · 1 comment
Owner

Originally created by @yashiroiori on GitHub (Mar 13, 2022).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/67

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
Originally created by @yashiroiori on GitHub (Mar 13, 2022). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/67 I try to send de query but send me an error Query: { metrics { id name paginatorInfo{ count currentPage firstItem hasMorePages lastItem lastPage perPage total } } } <img width="1102" alt="image" src="https://user-images.githubusercontent.com/17031855/158078973-3fa4b996-7582-4985-85ee-d413ea7e7ec1.png"> 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?? <img width="552" alt="image" src="https://user-images.githubusercontent.com/17031855/158079007-95bf54cc-a6e4-49aa-97fd-75701d8f8a69.png">
kerem closed this issue 2026-03-03 00:02:55 +03:00
Author
Owner

@yashiroiori commented on GitHub (Mar 13, 2022):

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) + " }" : ""} };
}

<!-- gh-comment-id:1066189095 --> @yashiroiori commented on GitHub (Mar 13, 2022): > I try to send de query but send me an error > > Query: { metrics { id name paginatorInfo{ count currentPage firstItem hasMorePages lastItem lastPage perPage total } } } > > <img alt="image" width="1102" src="https://user-images.githubusercontent.com/17031855/158078973-3fa4b996-7582-4985-85ee-d413ea7e7ec1.png"> > > 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?? > > <img alt="image" width="552" src="https://user-images.githubusercontent.com/17031855/158079007-95bf54cc-a6e4-49aa-97fd-75701d8f8a69.png"> 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) + " }" : ""} }`; }
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#40
No description provided.