0

Lets assume I have one gateway service and two domain services A and B. Using graphql federation I would like to stitch them together to a unified graphql schema accessible via the gateway service.

The domain service have the following query types:

Service A

type Query {
  version: String;
}

Service B

type Query {
  version: String;
}

The resulting schema would look something like this

type Query {
  version: String!
  b_version: String!
}

Is it possible to add a "virtual" child node for each domain service to kind of namespace them?
Ideally I would like to configure domain services in appsettings.json and let the gateway service do the magic. I do this currently but with the aforementioned renaming issues.

type QueryA {
  version: String
}

type QueryA {
  version: String
}

type Query {
  a: QueryA
  b: QueryB
}

Sample query

// Example query
query {
  a { version }
  b { version }
}

I'm using HotChocolate v.13

TorbenJ
  • 4,462
  • 11
  • 47
  • 84
  • In my opinion, `type Query` is actually equivalent to a class, and there cannot be two attributes with the same name, so if your `QueryA` and `QueryB` both have the attribute version, renaming is unavoidable. What do your domain services achieve? Can it be replaced by class? Then you can use `ObjectType` like in [this link](https://stackoverflow.com/a/66844966/18789859) to achieve. – Chen Feb 13 '23 at 09:33

0 Answers0