Skip to content

Commit 90889ca

Browse files
committed
Merge branch 'master' of github.com:graphql-python/graphene
2 parents 9dcd798 + 0daf6d8 commit 90889ca

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/pages/docs/basic-types.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,21 @@ graphene.Field(graphene.String(), to=graphene.String())
8282
# Is equivalent to:
8383
graphene.Field(graphene.String(), to=graphene.Argument(graphene.String()))
8484
```
85+
86+
87+
## Using custom object types as argument
88+
89+
To use a custom object type as an argument, you need to inherit `graphene.InputObjectType`, not `graphene.ObjectType`.
90+
91+
```python
92+
class CustomArgumentObjectType(graphene.InputObjectType):
93+
field1 = graphene.String()
94+
field2 = graphene.String()
95+
96+
```
97+
98+
Then, when defining this in an argument, you need to wrap it in an `Argument` object.
99+
100+
```python
101+
graphene.Field(graphene.String(), to=graphene.Argument(CustomArgumentObjectType))
102+
```

0 commit comments

Comments
 (0)