Comments (7)
Hi @dilip9292. could we get some more info like what version of bramble you're running and how your example is being run?
There is no reason that shouldn't work, I've created an equivalent test case that behaves as I'd expect and I believe that's even a pattern we use in production.
from bramble.
@lucianjon Thank you for taking a look
We are using bramble 1.4.0 . I cannot give exact details but i can give an example.
Graphql Resonse : Where Textbook and Magazine implements Book Interface
[
{___typename : "TextBook", author: "abc", title: "abc"},
{___typename : "Magazine", publisher: "def", title: "abc"},
]
But bramble response after connecting graphql service is like
[
{___typename : "TextBook"},
{___typename : "Magazine"},
]
from bramble.
@dilip9292 We dug into this and suspect that the issue is that you have two different spellings for the Textbook type. One is Textbook
and the other one is TextBook
. Fixing the spelling seems to resolve the issue. Can you double check on your end and report back? Thanks!
from bramble.
Hi @nmaquet This was just an example. However i tried writing a test case and one thing i could notice was if service does not return _bramble__typename then the issue is seen.
Currently my hypothesis is that
Currently when we run a graphql service and put a gateway infront of if the, service would not know that there is a bramble gateway infront of it and it does not return _bramble__typename.
The test case below is eaxctly our case and it passes when service returns _bramble__typename
serviceC := testService{ schema:
directive @boundary on OBJECT
interface Snapshot {
id: ID!
name: String!
}
interface Gozmo {
id: ID!
}
type GozmoImplementation implements Snapshot {
id: ID!
name: String!
gozmos: [Gozmo!]!
}
type Gizmo implements Gozmo {
id: ID!
name: String!
}
type Gadget implements Gozmo {
id: ID!
name: String!
}
type Query {
snapshots: [Snapshot!]!
}`,
handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
{
"data": {
"snapshots": [
{
"id": "100",
"name": "foo",
"gozmos": [
{ "__typename": "Gadget", "id": "GADGET1" },
{ "__typename": "Gizmo", "id": "GIZMO1" }
],
"_bramble__typename": "GozmoImplementation"
}
]
}
}`))
}),
}`
`t.Run("test with multiple implementation fragment spreads (gadget implementation)", func(t *testing.T) {
f := &queryExecutionFixture{
services: []testService{serviceC},
query: `
query Foo {
snapshots {
... NamedFragment
}
}
fragment GizmoFragment on Gizmo {
id
}
fragment GadgetFragment on Gadget {
id
}
fragment GozmoImplementationsFragment on Gozmo {
__typename
... GizmoFragment
... GadgetFragment
}
fragment NamedFragment on GozmoImplementation {
id
name
gozmos {
...GozmoImplementationsFragment
}
}`,
expected: `
{
"snapshots": [
{
"id": "100",
"name": "foo",
"gozmos": [
{
"__typename": "Gadget",
"id": "GADGET1"
},
{
"__typename": "Gizmo",
"id": "GIZMO1"
}
]
}
]
}`,
}
f.checkSuccess(t)
})`
from bramble.
@dilip9292 __bramble_typename
is injected into the selection set passed to the downstream service during the planning stage of a bramble request (
Line 176 in cc52747
from bramble.
@lucianjon Thank you for validating my hypothesis.
I have done a small check i took the above testcase and ran it aginst the latest code base and it works.
I have reverted changes done on May 4 and ran again it failed.
Since the release tag(1.4.0) was created on May 2nd we might need an another release. What do you think?
Test case of concern
serviceC := testService{ schema:
directive @boundary on OBJECT
interface Snapshot {
id: ID!
name: String!
}
interface Gozmo {
id: ID!
}
type GozmoImplementation implements Snapshot {
id: ID!
name: String!
gozmos: [Gozmo!]!
}
type Gizmo implements Gozmo {
id: ID!
name: String!
}
type Gadget implements Gozmo {
id: ID!
name: String!
}
type Query {
snapshots: [Snapshot!]!
}`,
handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
{
"data": {
"snapshots": [
{
"id": "100",
"name": "foo",
"gozmos": [
{ "__typename": "Gadget", "id": "GADGET1" },
{ "__typename": "Gizmo", "id": "GIZMO1" }
],
"_bramble__typename": "GozmoImplementation"
}
]
}
}`))
}),
}
t.Run("test with multiple implementation fragment spreads (gadget implementation)", func(t *testing.T) {
f := &queryExecutionFixture{
services: []testService{serviceC},
query: `
query Foo {
snapshots {
... NamedFragment
}
}
fragment GizmoFragment on Gizmo {
id
}
fragment GadgetFragment on Gadget {
id
}
fragment GozmoImplementationsFragment on Gozmo {
__typename
... GizmoFragment
... GadgetFragment
}
fragment NamedFragment on GozmoImplementation {
id
name
gozmos {
...GozmoImplementationsFragment
}
}`,
expected: `
{
"snapshots": [
{
"id": "100",
"name": "foo",
"gozmos": [
{
"__typename": "Gadget",
"id": "GADGET1"
},
{
"__typename": "Gizmo",
"id": "GIZMO1"
}
]
}
]
}`,
}
f.checkSuccess(t)
})`
from bramble.
@dilip9292 That would explain it, I thought we had that fix in our latest release. Have released https://github.com/movio/bramble/releases/tag/v1.4.1. Will close this for now but feel free to reopen if you have issues on v1.4.1.
from bramble.
Related Issues (20)
- Request syntax error while trying to upload file HOT 6
- persisted queries HOT 1
- using Bramble as a library, add query/mutation resolvers in the gateway HOT 3
- 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.