Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill type data from multiple services #71

Closed
ynonp opened this issue Sep 10, 2021 · 2 comments
Closed

Fill type data from multiple services #71

ynonp opened this issue Sep 10, 2021 · 2 comments

Comments

@ynonp
Copy link

ynonp commented Sep 10, 2021

Hi Bramble,

Working with shared types, I was able to get multiple services to fill the same type when it's in the root query, but could not get this to work when the object is in an inner query.

For example assume I have a "tasks" service and a "profiles" service, and each task can have an "owner" field which is a Profile.
Given the following schema for tasks:

directive @boundary on OBJECT | FIELD_DEFINITION

type Query {
  tasks(done: Boolean): [Task]
  task(id: String): Task
  service: Service!
  tasks__profile(id: ID!): Profile @boundary
}

type Profile @boundary {
  id: ID!
}

type Task {
  _id: String
  text: String
  done: Boolean
  owner: Profile
}

type Service {
  name: String! # unique name for the service
  version: String! # any string
  schema: String! # the full schema for the service
}

And this schema for a Profile service:

directive @boundary on OBJECT | FIELD_DEFINITION

type Query {
  service: Service!
  profile(id: ID!): Profile @boundary
  someone: Profile
}

type Profile @boundary {
  id: ID!
  first_name: String
  last_name: String
}

type Service {
  name: String! # unique name for the service
  version: String! # any string
  schema: String! # the full schema for the service
}

I have no problem using the someone query to get a profile and fill its fields from both services, but when I try to read the tasks and data about their owners such as:

query {
  tasks {
    text
    owner {
       id
       first_name
    }
  }
}

I will get just "null" as the result data.

If I remove first_name field from the query everything will work and I will get the correct id of the owner, so I assume tasks service works ok.

Is there a way to get bramble gateway to fill inner owner query from a different service?

@nmaquet
Copy link
Contributor

nmaquet commented Sep 12, 2021

Hey @ynonp, your schema looks valid to me and the query should work. Is Bramble logging out any error? Does the query response give out any error?

If I remove first_name field from the query everything will work and I will get the correct id of the owner, so I assume tasks service works ok.

OK, but what about the profile service? Is it getting called? What is it responding with?

@nmaquet
Copy link
Contributor

nmaquet commented Nov 1, 2021

Closing this for now due to lack of activity. @ynonp Feel free to reopen if you'd like additional assistance.

@nmaquet nmaquet closed this as completed Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants