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
Hello, I am evaluating a few different GraphQL implementations that would sit in front of an existing REST service and am having some uncertainty as to how to best accomplish something specific.
As an example our REST service exposes say:
GET /foos
GET /foo/{id}
and both of those support a query param:
GET /foos?selector=bar,baz
GET /foo/{id}?selector=bar,baz
In GraphQL I would like to treat bar,baz as fields which have their own fields:
query Foo {
Foo(id: "974cf6b9-ab84-4276-9284-91f01e1dbe92") {
id
name
size
bar {
id
name
}
baz {
etag
}
}
}
The inclusion of bar and baz result in the service making separate requests to fetch the data and so are skipped if the the request lacks the respective ?selector query param. I'm not sure how to map this to DGS.
I have a FooDataFetcher that talks to a FooService. Following the example for child data it would in this case would result in code like:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am evaluating a few different GraphQL implementations that would sit in front of an existing REST service and am having some uncertainty as to how to best accomplish something specific.
As an example our REST service exposes say:
and both of those support a query param:
In GraphQL I would like to treat
bar,bazas fields which have their own fields:The inclusion of
barandbazresult in the service making separate requests to fetch the data and so are skipped if the the request lacks the respective?selectorquery param. I'm not sure how to map this to DGS.I have a
FooDataFetcherthat talks to aFooService. Following the example for child data it would in this case would result in code like:which would result in three separate REST queries:
which I would like to avoid.
I'm guessing that somehow this problem would be best solved through the use of a
DataLoaderwhere it would accumulate:Foowithid=1Foowithid=1andselector=barFoowithid=1andselector=bazwhich gets resolve to a single request:
But I'm not sure if I'm on the right track with this thinking and can't find supporting cases in the examples. Thank you for any assistance.
Beta Was this translation helpful? Give feedback.
All reactions