From 96b37242651021e49e8f282a1ae0c6b017de29de Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 9 Feb 2025 12:34:31 +0100 Subject: [PATCH] add missing RELEASE.md file --- RELEASE.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..fb9124ea5a --- /dev/null +++ b/RELEASE.md @@ -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 +} +```