-
-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45720b6
commit 96b3724
Showing
1 changed file
with
60 additions
and
0 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,60 @@ | ||
Release type: patch | ||
|
||
This release adjusts the schema printer to avoid printing a schema directive | ||
value set to `UNSET` as `""` (empty string). | ||
|
||
For example, the following: | ||
|
||
```python | ||
@strawberry.input | ||
class FooInput: | ||
a: str | None = strawberry.UNSET | ||
b: str | None = strawberry.UNSET | ||
|
||
|
||
@strawberry.schema_directive(locations=[Location.FIELD_DEFINITION]) | ||
class FooDirective: | ||
input: FooInput | ||
|
||
|
||
@strawberry.type | ||
class Query: | ||
@strawberry.field(directives=[FooDirective(input=FooInput(a="aaa"))]) | ||
def foo(self, info) -> str: ... | ||
``` | ||
|
||
Would previously print as: | ||
|
||
```graphql | ||
directive @fooDirective( | ||
input: FooInput! | ||
optionalInput: FooInput | ||
) on FIELD_DEFINITION | ||
|
||
type Query { | ||
foo: String! @fooDirective(input: { a: "aaa", b: "" }) | ||
} | ||
|
||
input FooInput { | ||
a: String | ||
b: String | ||
} | ||
``` | ||
|
||
Now it will be correctly printed as: | ||
|
||
```graphql | ||
directive @fooDirective( | ||
input: FooInput! | ||
optionalInput: FooInput | ||
) on FIELD_DEFINITION | ||
|
||
type Query { | ||
foo: String! @fooDirective(input: { a: "aaa" }) | ||
} | ||
|
||
input FooInput { | ||
a: String | ||
b: String | ||
} | ||
``` |