mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-30 23:47:55 +03:00 
			
		
		
		
	Merge branch 'master' of github.com:graphql-python/graphene
This commit is contained in:
		
						commit
						90889ca455
					
				|  | @ -82,3 +82,21 @@ graphene.Field(graphene.String(), to=graphene.String()) | |||
| # Is equivalent to: | ||||
| graphene.Field(graphene.String(), to=graphene.Argument(graphene.String())) | ||||
| ``` | ||||
| 
 | ||||
| 
 | ||||
| ## Using custom object types as argument | ||||
| 
 | ||||
| To use a custom object type as an argument, you need to inherit `graphene.InputObjectType`, not `graphene.ObjectType`. | ||||
| 
 | ||||
| ```python | ||||
| class CustomArgumentObjectType(graphene.InputObjectType): | ||||
|     field1 = graphene.String() | ||||
|     field2 = graphene.String() | ||||
| 
 | ||||
| ``` | ||||
| 
 | ||||
| Then, when defining this in an argument, you need to wrap it in an `Argument` object. | ||||
| 
 | ||||
| ```python | ||||
| graphene.Field(graphene.String(), to=graphene.Argument(CustomArgumentObjectType)) | ||||
| ``` | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user