sangria-graphql / sangria

Scala GraphQL implementation
https://sangria-graphql.github.io
Apache License 2.0
1.96k stars 223 forks source link

Extending Schema with type dependency #415

Open ayyappanramamuniappa opened 5 years ago

ayyappanramamuniappa commented 5 years ago

I am new to graphql and I have some question from your examples. I tried the following example for different schema .

I am trying to stitch two schemas to one schema. I am getting comment from another service through introspection.

But when I extend the schema, I get an schema validation error that Article type is unknown when I extend schema using builder.

val extensions =
    gql"""
    extend type Article {
    comments: [Comment]! @loadComments
    }

    type Comment {
      text: String!
      author: CommentAuthor!
    }

    type CommentAuthor {
      name: String!
      lastComment: Comment
    }
    """
OlegIlyenko commented 5 years ago

It's hard to provide a suggestion based in the information you have shown. I would definitely recommend you to check this project: https://github.com/OlegIlyenko/graphql-gateway It provides some examples of combining together multiple schemas. But otherwise it would be great if you could create a small self-contained example that reproduces this issue. This gist might be helpful as a template for it: https://gist.github.com/OlegIlyenko/4068ad92e008cd4b5def1baa4ec3a67c