-
-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for optional arguments when a default value is provided (#82
) * added support for optional arguments when a default value is provided * fixed no default arguments case * Switched default argument detection to use inspect.signature, added tests for default arguments with custom types * added release info
- Loading branch information
1 parent
0651357
commit f380a5d
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Release type: minor | ||
|
||
Added support for optional fields with default arguments in the GraphQL schema when default arguments are passed to the resolver. | ||
|
||
Example: | ||
```python | ||
@strawberry.type | ||
class Query: | ||
@strawberry.field | ||
def hello(self, info, name: str = "world") -> str: | ||
return name | ||
``` | ||
|
||
```graphql | ||
type Query { | ||
hello(name: String = "world"): String | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters