cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in merging two schema type

Hello ,i want to merge two schema result for making nodes.Since graphql does not make the statement merge , i am trying this example...

 type User  {
                id:ID!
                User_ID:String!
                Mobile_Number:String!
                Name:String!
                Email_Id:String!
                Country_Id:String!
                DOB:String!
                Status:String!
                Friends:[String!]!
                settings:[Settings]
             }
         type  Settings {
                id:ID!
                User_ID:String!
                Auto_Check_In:String!
                Notification:String!
                Selected_Recommendation:String!
                Status:String!
                user:[User]
            }

output-

{
  "data": {
    "users": [
      {
        "id": "0.55515894979673",
        "User_ID": "2",
        "Name": "kp",
        "settings": null
      }
    ]
  }
}

i am expecting the value of settings should be merge in user data ..
Can anyone please guide me how to merge this two schema, or any other way to do so.

2 REPLIES 2

William_Lyon
Graph Fellow

Hi @nikita.vhits -

The settings field should represent a relationship connecting the User and Settings node. You'll want to use the @relation schema directive in your type definitions to indicate the relationship:

settings: [Settings] @relation(name: "HAS_SETTINGS", direction: "OUT")

See the docs for more info: https://grandstack.io/docs/graphql-relationship-types.html#defining-relationships-in-sdl

Hii @William_Lyon
i had try this out but its show me error for Unknown directive "relation".Can u please tell me any other solution.

thanks