Search code examples
metadatagraphene-python

Graphene-Python documentation on clients view


The description property on GraphQL's schema elements can be viewed by the client. For example, GraphQL shows the description value for a field object in the type-ahead dropdown that lists fields available inside a selection set. This same description appears on the documentation section. Can this type of metadata documentation be added through graphene-gae? My set up:

models.py:

class Article(ndb.Model):
    headline = ndb.StringProperty()
    author_key = ndb.KeyProperty(kind='Author')
    created_at = ndb.DateTimeProperty(auto_now_add=True)

import graphene
from graphene_gae import NdbObjectType

Schema.py:

class ArticleType(NdbObjectType):
    class Meta:
        model = Article

class Query(graphene.ObjectType):
    articles = graphene.List(ArticleType)

    @graphene.resolve_only_args
    def resolve_articles(self):
        return Article.query()

schema = graphene.Schema(query=QueryRoot)

Solution

  • I can add descriptions like this:

    headline = ndb.StringProperty(description='Add description here!')
    

    Super Easy!