Comments (9)
@gmac I had to track this one down myself but it's happening in formatSelectionSet
here https://github.com/movio/bramble/blob/main/query_execution.go#L100 and that will trace down to expandAndFormatVariable
. Essentially all of the variables are stored inside the http context and then inlined last minute based on matching up the variable names.
from bramble.
@gmac variables are also used to evaluate @skip
and @include
directives here:
Line 155 in 9c75195
(you can see how they're extracted from the context, too).
from bramble.
Whhhoooaa, I totally overlooked the significance of the formatting lib here. I kind of assumed that was just a “dumb” string utility and that all the primary logic would be happening as an AST transformation in the execution process. Thanks for the pointer, I see it now!
One related question on @skip
and @include
… I was surprised to see those included in the gateway. Technically, couldn’t those just get passed through to the underlying subservices to evaluate? I guess that could mess with null evaluation?
from bramble.
One related question on @Skip and @include… I was surprised to see those included in the gateway. Technically, couldn’t those just get passed through to the underlying subservices to evaluate? I guess that could mess with null evaluation?
It was relatively easy to implement so we added it in. I don't think there is a downside to doing this? With very large documents, it may also be quite a bit more efficient, since pruning the selection set may result in calling fewer downstream services.
from bramble.
Makes sense. I can’t think of a downside either, I was just surprised to see them there.
from bramble.
A year later I've probably found a downside of inlining.
I'm trying to implement patch-like update mutation and distinguish between null fields and not send (undefined).
So on service side I'm looking into variables (selection set) and skip any of them if they are not present.
Is it possible to pass variables to downstream services? Or maybe there is another workaround?
from bramble.
@benzolium we also found an issue with inlining variables recently with custom scalars and the difference between serialisation as JSON and GraphQL.
I think the answer will be to stop expanding and inline variables into the downstream service queries, and instead extract the relevant variables from the request payload, and pass them downstream.
from bramble.
@pkqk could you please guide me how can I do it? Should I make a fork of bramble?
from bramble.
@benzolium if you'd like to have a go at it then you can fork bramble and make a PR to this repo.
In format.go it currently extracts the variables from the request context while formatting the queries for all the downstream services, and then inlines them into each query.
You'd need to alter buildBoundaryQueryDocuments
and executeBoundaryQuery
called in execution.go so instead it collects the variables used in each query and passes them along to the downstream services.
from bramble.
Related Issues (20)
- Request syntax error while trying to upload file HOT 5
- persisted queries HOT 1
- using Bramble as a library, add query/mutation resolvers in the gateway HOT 3
- Fragment not mapping fields for interface types HOT 7
- Lack of server timeouts HOT 1
- should bramble complain about built-in directives declared in spec? HOT 4
- Enabling/Disabling schema introspection HOT 6
- Types not used in any query are not getting into compiled schema? HOT 2
- Plugin` configuration doesnt depend on config changes HOT 3
- Differentiate log level depending on "response.status" HOT 4
- Schema being cached? HOT 1
- OperationPermissions dependent on type ID HOT 1
- Cannot access timings HOT 3
- nested abstract fragment error if returned type not queried HOT 5
- Bramble fails to read scheme HOT 2
- Rate limiters on Bramble? HOT 1
- Strict-Transport-Security on Bramble? HOT 1
- Add Datadog graphql trace HOT 8
- Config.json not loaded with docker volume HOT 1
- Allowed headers does not reach sub service HOT 3
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 bramble.