From 3c0bbefa28864336e69cc68226ba75625bf9ad07 Mon Sep 17 00:00:00 2001 From: rafalp Date: Sun, 6 Oct 2024 00:10:39 +0200 Subject: [PATCH] Fix error, add problems to readme --- README.md | 13 +++++++++++++ example/queries/__init__.py | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c9ad83..cf73dc6 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,16 @@ An example GraphQL API implemented with Ariadne GraphQL Modules v2. This API aims to use ALL features from GraphQL Modules v2. It can also be used as a reference for other developers. + + +# Problems found + +## `list[SchemaType]` type in `make_executable_schema` + +`list` is [invariant in mypy](https://mypy.readthedocs.io/en/stable/common_issues.html#variance). A list of `type[GraphQLObject]`, like one from the `example.queries.__init__` produces an error because `list[type[GraphQLObject]]` is incompatible with `list[type[GraphQLType]]`. + + +## Resolvers need to be `@classmethod` or `@staticmethod` to keep linters happy. + +Linters will scream that resolver method decorated with `@ObectType.resolver` is missing `self` first attribute. + diff --git a/example/queries/__init__.py b/example/queries/__init__.py index ad84596..07f0b0a 100644 --- a/example/queries/__init__.py +++ b/example/queries/__init__.py @@ -1,6 +1,8 @@ +from typing import Any + from . import groups, hello, users -queries = [ +queries: Any = [ groups.Query, hello.Query, users.Query,