Trying to better understand the federation transform. #2863
Unanswered
Davenporten
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Could you create an example with this scenario? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have the same problem with my implementation. I try to put graphql-mesh in front of a federated subgraph (service). But all I receive is: ❯ yarn run start
yarn run v1.22.10
$ mesh dev
🕸️ - Server: Serving GraphQL Mesh: http://0.0.0.0:4000 in 1 forks
🕸️: An error occured while writing the schema file: Unknown directive "@extends".
🕸️: An error occurred while building the mesh artifacts: Unknown directive "@extends".
🕸️ - Server: Generating Mesh schema...
🕸️: An error occured while writing the schema file: Unknown directive "@extends".
🕸️: An error occurred while building the mesh artifacts: Unknown directive "@extends".
🕸️ - Server: Unknown directive "@extends". .meshrc.yaml contains: sources:
- name: TenantService
handler:
graphql:
endpoint: http://localhost:8010/graphql
operationHeaders:
Authorization: "{context.headers['authorization']}"
- name: UserService
handler:
graphql:
endpoint: http://localhost:8020/graphql
operationHeaders:
Authorization: "{context.headers['authorization']}" And the TenantService contains the following declaration to extend the User type by adding "tenant" to it: type User @key(fields: "id") @extends {
id: ID! @external
tenant(filters: TenantOptions @spread): Tenant!
@belongsTo(scopes: ["filters"])
@can(ability: "tenant.show")
} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I have a graphql server, and I want to integrate it into my graphql-mesh instance. On this server I have a type
which is used for a few different fields in other types.
I also have some typedefs and resolvers that live alongside my graphql-mesh configs that get incorporated into the unified schema. Among these I have a
User
type:What I want to happen is when my graphql server is integrated to my mesh instance that federation can occur and when
User
is returned for query/mutation that's in the server it will be able to return the federatedUser
, as in it has all those extra fields, etc. I've tried doing federation with the straight annotationsBut while this works if I'm using Apollo Federation tools (ApolloServer/ApolloGateway), graphql-mesh doesn't recognize
@extends
. So instead I want to add the annotations to theUser
type that's coming in from my server with something likebut this also doesn't work, I get
it seems that this is creating a new type
User
rather than modifying theUser
coming from my server. Is that how it's supposed to work? I thought it was going to change the type, but maybe I'm mistaken. If I am, is what I'm describing above even possible with graphql-mesh?Beta Was this translation helpful? Give feedback.
All reactions