mercredi 1 juillet 2020

How can I get object field descriptions to ouput with a Graphene GraphQL schema?

I have my graphql schema implemented in graphene, with the a test object and schema object being:

class Test(ObjectType):
    id = ID(description='Test ID')
    test_string = String(description='Test String')

schema = Schema(query=Query, subscription=Subscription, mutation=Mutation)

For testing and front end development purposes, I print out the schema using:

from server.graphql_handler.schema import schema
print(schema)

This gives me something like this:

schema {
    query: Query
    mutation: Mutation
    subscription: Subscription
}

type Test {
    id: ID
    test_string: String
}

My question being, is is possible to output the Test object fields' descriptions as well? Maybe something like:

type Test {
    """
    Test ID
    """"
    id: ID

    """
    Test String
    """
    test_string: String
}

Aucun commentaire:

Enregistrer un commentaire