Comments (3)
Seems like this is working, but I'm not sure if its ideal:
In the parent resolver return the DataFetcherResult
instead of the actual result, together with localContext
set with the data object you want to share down the tree line, in this example its the request
argument.
@Query
fun foo(request: ProtoRequestParams): ProtoResult {
return DataFetcherResult.newResult<ProtoResult>()
.data(getData(request))
.localContext(request)
.build()
}
And then in the child field resolver:
@SchemaModification(addField = "specificProperty", onType = ProtoItem::class)
fun specificProperty(item: ProtoItem, dataFetchingEnvironment: DataFetchingEnvironment): CompletableFuture<List<ProtoSpecificProperty>>? {
val argument = dataFetchingEnvironment.getLocalContext<ProtoRequestParams>()
// use the argument to resolve this field
}
Note that this code examples are in Kotlin.
from rejoiner.
Hi
Maybe I'm misunderstanding but to me it feels wrong that the resolution of specificProperty
would depend on anything other than the item
that it is connected to.
Could it be that Input_proto_request_params
contains some context info for your query that should be repeated as a parameter on specificProperty
?
I'm trying to solve a similar problem myself a.t.m. I'm using a hierarchy of implicitly retrieved context, well known variables and explicit parameters to solve that but I'm not sure what is "the right way" here...
from rejoiner.
Hello,
Maybe I'm misunderstanding but to me it feels wrong that the resolution of specificProperty would depend on anything other than the item that it is connected to.
According to the GraphQL specs, this scenario should be possible. That a child inherits arguments from its parent.
Could it be that Input_proto_request_params contains some context info for your query that should be repeated as a parameter on specificProperty?
Exactly, specificProperty
requires Input_proto_request_params
as well as its parent.
I'm trying to solve a similar problem myself a.t.m. I'm using a hierarchy of implicitly retrieved context, well known variables and explicit parameters to solve that but I'm not sure what is "the right way" here...
I was also thinking to just add this requirement directly on the field, but then the client needs to duplicate this argument, which I would rather avoid. I've solved it by setting localContext
, not sure if that's the right way to go though.
from rejoiner.
Related Issues (20)
- nicer JSON for standard wrappers HOT 11
- google_protobuf_Any value string HOT 1
- Rejoiner - Relay support thoughts HOT 5
- Sample/Example if backend GRPC services are in different language?
- Errors executing GraphQL request HOT 2
- Activity? HOT 4
- Request for Help on `GraphQL Stream (based on gRPC streaming)`
- Question: TypeModifcation - Replace field with context
- There is a vulnerability in Jetty: Java based HTTP/1.x, HTTP/2, Servlet, WebSocket Server 9.3.8.v20160314,upgrade recommended
- Missing "TestProto" component
- Question: rejoiner inside existing grpc service? HOT 2
- Exception when starting up Spring Boot 2.7.7/Java 17 app with Rejoiner HOT 2
- proto options not present in input messages
- Documentation website down. Open contributors?
- Documentation website down. Open contributors? HOT 3
- Archive the repository
- Quick Start Guide HOT 2
- modularization HOT 3
- errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rejoiner.