diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c3990234..9bfe3e69d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,44 @@ CHANGELOG ========= +0.198.0 - 2023-07-31 +-------------------- + +This release adds support for returning interfaces directly in resolvers: + +```python +@strawberry.interface +class Node: + id: strawberry.ID + + @classmethod + def resolve_type(cls, obj: Any, *args: Any, **kwargs: Any) -> str: + return "Video" if obj.id == "1" else "Image" + + +@strawberry.type +class Video(Node): + ... + + +@strawberry.type +class Image(Node): + ... + + +@strawberry.type +class Query: + @strawberry.field + def node(self, id: strawberry.ID) -> Node: + return Node(id=id) + + +schema = strawberry.Schema(query=Query, types=[Video, Image]) +``` + +Contributed by [Patrick Arminio](https://github.com/patrick91) via [PR #2989](https://github.com/strawberry-graphql/strawberry/pull/2989/) + + 0.197.0 - 2023-07-30 -------------------- diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index 39cb65e139..0000000000 --- a/RELEASE.md +++ /dev/null @@ -1,33 +0,0 @@ -Release type: minor - -This release adds support for returning interfaces directly in resolvers: - -```python -@strawberry.interface -class Node: - id: strawberry.ID - - @classmethod - def resolve_type(cls, obj: Any, *args: Any, **kwargs: Any) -> str: - return "Video" if obj.id == "1" else "Image" - - -@strawberry.type -class Video(Node): - ... - - -@strawberry.type -class Image(Node): - ... - - -@strawberry.type -class Query: - @strawberry.field - def node(self, id: strawberry.ID) -> Node: - return Node(id=id) - - -schema = strawberry.Schema(query=Query, types=[Video, Image]) -``` diff --git a/pyproject.toml b/pyproject.toml index 3997bb5c04..e92abc4488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "strawberry-graphql" packages = [ { include = "strawberry" } ] -version = "0.197.0" +version = "0.198.0" description = "A library for creating GraphQL APIs" authors = ["Patrick Arminio "] license = "MIT"