Documentation doesn't get generated because of Syntactic Sugar of Interfaces in Dgraph GraphQL

Hi Team,

I created the schema and accompanying documentation, which works well when I just put all the predicates in their respective types. The documentation is properly presented by GraphQL Playground.

When I moved common predicates into a separate Interface, the documentation stops working.

I can recall from a talk by @mrjn, in YouTube video, the predicates are copied over to wherever they are implemented at runtime.

As it follows the principle of DRY, I have nothing against it. However, I am torn between having documentation and not repeating myself with interfaces.

e.g.

Before:

type Comment {

“”"
Tag NSFW if vulgar
Tag Spoiller if the content spoils a movie or a game
“”"
tag: [Tags!]
}

type Article {

“”"
Tag NSFW if vulgar
Tag Spoiller if the content spoils a movie or a game
“”"
tag: [Tags!]
}

After:

interface Post {

“”"
Tag NSFW if vulgar
Tag Spoiller if the content spoils a movie or a game
“”"
tag: [Tags!]
}

type Article implements Post {
}

type Comment implements Post {
}

Is there a workaround, to make the introspection work without repetition, or do I have to make peace with not having documentation for those specific predicates?

P.S. This only seems odd for scalar values, as composite values have their separate documentation.

Hi @abhijit-kar
Not quite sure what do you mean by “documentation stops working” Can you share which fields can’t you see in the documentation?

It was the fault of GraphQL Playground for not showing documentation on Interfaces, but Altair is able to show the documentation.

There’s no problem anymore.

Thank you for a reply.

1 Like