You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
will make 10 requests, one for each username of the first 10 users. This could sometimes be served by a single request that accepts an array of 10 usernames (for apis that accept that).
Links to Discuss, RFC or previous Issues and PRs
No response
Links to examples and research
No response
Current state
No response
Solution proposal
Each API will be different in how it accepts a batch of data, so some expression syntax will be needed for this to work.
It would be ideal to specify how to do this. One way would be to interpret "batchUrl" as a pre-fetch syntax that defines how to get all data and put it in a map keyed by the fetch parameter, which is then used as needed in building the GraphQL result.
It is unclear the best way to accomplish this right now.
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Use case
A custom query may be invoked in a chatty way for large GraphQL requests. E.g.
type User {
username: String! @id
...
posts: [Post] @Custom(http: {
url: "https://my.api.com/person/$username/posts",
method: GET
})
}
and a query
queryUser (first: 10) {
posts
}
will make 10 requests, one for each username of the first 10 users. This could sometimes be served by a single request that accepts an array of 10 usernames (for apis that accept that).
Links to Discuss, RFC or previous Issues and PRs
No response
Links to examples and research
No response
Current state
No response
Solution proposal
Each API will be different in how it accepts a batch of data, so some expression syntax will be needed for this to work.
batchUrl: https://my.api.com/person/posts?usernames=[$username] // where $username is expanded to an array of all usernames
It would be ideal to specify how to do this. One way would be to interpret "batchUrl" as a pre-fetch syntax that defines how to get all data and put it in a map keyed by the fetch parameter, which is then used as needed in building the GraphQL result.
It is unclear the best way to accomplish this right now.
Additional Information
No response
The text was updated successfully, but these errors were encountered: