Skip to content

Docs and Example Code Style Guide Work: graphene v 3.0

changeling edited this page Jun 7, 2019 · 3 revisions

Tracking page for documentation and example code Style Guide discussion.

Elements discussed and decided:

Use class arguments instead of class Meta.

Example: Instead of:

    class Human(graphene.ObjectType):
        class Meta:
            interfaces = (Character, )

        starships = graphene.List(Starship)
        home_planet = graphene.String()

Use:

    class Human(graphene.ObjectType, interfaces = (Character, )):
        starships = graphene.List(Starship)
        home_planet = graphene.String()

Use f-strings in place of .format(...).

Open for discussion:

Using root instead of self or _ in resolver definitions.

@staticmethod?

Clone this wiki locally