-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(printer): Fix printer ignoring input arguments using snake_case (#…
…3780) * fix(printer): Fix printer ignoring input arguments using snake_case Fix #3760 * Update strawberry/printer/printer.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update RELEASE.md Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * one missing propagation * skip test on gql2 due to different formatting --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b8bda78
commit 826287f
Showing
3 changed files
with
149 additions
and
8 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,65 @@ | ||
Release type: patch | ||
|
||
This release fixes an issue where directives with input types using snake_case | ||
would not be printed in the schema. | ||
|
||
For example, the following: | ||
|
||
```python | ||
@strawberry.input | ||
class FooInput: | ||
hello: str | ||
hello_world: str | ||
|
||
|
||
@strawberry.schema_directive(locations=[Location.FIELD_DEFINITION]) | ||
class FooDirective: | ||
input: FooInput | ||
|
||
|
||
@strawberry.type | ||
class Query: | ||
@strawberry.field( | ||
directives=[ | ||
FooDirective(input=FooInput(hello="hello", hello_world="hello world")), | ||
] | ||
) | ||
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: { hello: "hello" }) | ||
} | ||
|
||
input FooInput { | ||
hello: String! | ||
hello_world: String! | ||
} | ||
``` | ||
|
||
Now it will be correctly printed as: | ||
|
||
```graphql | ||
directive @fooDirective( | ||
input: FooInput! | ||
optionalInput: FooInput | ||
) on FIELD_DEFINITION | ||
|
||
type Query { | ||
foo: String! | ||
@fooDirective(input: { hello: "hello", helloWorld: "hello world" }) | ||
} | ||
|
||
input FooInput { | ||
hello: String! | ||
hello_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