-
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? |
Beta Was this translation helpful? Give feedback.
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! |
Beta Was this translation helpful? Give feedback.
-
@ardatan thanks! |
Beta Was this translation helpful? Give feedback.
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!