mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-04 12:23:12 +03:00
Created Docs and Example Code Style Guide Work: graphene v 3.0 (markdown)
parent
e2ac2a00d1
commit
16f2c148cc
32
Docs-and-Example-Code-Style-Guide-Work:-graphene-v-3.0.md
Normal file
32
Docs-and-Example-Code-Style-Guide-Work:-graphene-v-3.0.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
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`?
|
Loading…
Reference in New Issue
Block a user