Repository navigation
type Query {
getOrders(offset: Int = 0, limit: Int = 50): PaginatedOrderList
getOrderById(id: Int!): Order
}
type Mutation {
addTracking(
id: String!
trackingNumber: String!
): AddTracking
}I already have all my possible operations defined. Why do I still need to create another file with the contents of the operations? query getOrders(
$limit: Int=50
$offset: Int=0
) {
getOrders(
limit: $limit
offset: $offset
) {
pageInfo {
total
}
results {
id
state
created
}
}
}Is there a way to generate all the operations based on my schema? |
Answered by
ardatan
Apr 30, 2021
Replies: 2 comments
|
We have this function builds operations by root field name; You can see the use cases here in the unit tests; I hope this helps you. If anyone wants to build a plugin based on these, we'd love to accept a PR! |
0 replies
Answer selected by
luisrudge
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have this function builds operations by root field name;
https://github.com/ardatan/graphql-tools/blob/master/packages/utils/src/build-operation-for-field.ts
You can see the use cases here in the unit tests;
https://github.com/ardatan/graphql-tools/blob/master/packages/utils/tests/build-operation-node-for-field.spec.ts
I hope this helps you. If anyone wants to build a plugin based on these, we'd love to accept a PR!