Skip to content

Commit

Permalink
Create RELEASE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
enoua5 authored Sep 28, 2024
1 parent db0b0d1 commit 5497709
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Release type: minor

The Query Codegen system now supports the `@oneOf` directive.

When writing plugins, you can now access `GraphQLObjectType.is_one_of` to determine if the object being worked with has a `@oneOf` directive.

The default plugins have been updated to take advantage of the new attribute.

For example, given this schema:

```python
@strawberry.input(one_of=True)
class OneOfInput:
a: Optional[str] = strawberry.UNSET
b: Optional[str] = strawberry.UNSET


@strawberry.type
class Query:
@strawberry.field
def one_of(self, value: OneOfInput) -> str: ...


schema = strawberry.Schema(Query)
```

And this query:

```graphql
query OneOfTest($value: OneOfInput!) {
oneOf(value: $value)
}
```

The query codegen can now generate this Typescript file:

```typescript
type OneOfTestResult = {
one_of: string
}

type OneOfInput = {
a: string,
b: never
} | {
a: never,
b: string
}

type OneOfTestVariables = {
value: OneOfInput
}
```

0 comments on commit 5497709

Please sign in to comment.