Repository: simonw/datasette-graphql (language: python)

Issue:
Upgrade to Graphene 3.1.0
I think this is breaking things.
Upgrade to Graphene 3.1.0
I think this is breaking things.


Discussion / hints:

Fix patch:
diff --git a/datasette_graphql/__init__.py b/datasette_graphql/__init__.py
index 61238eb..06bce23 100644
--- a/datasette_graphql/__init__.py
+++ b/datasette_graphql/__init__.py
@@ -1,7 +1,6 @@
 from click import ClickException
 from datasette import hookimpl
 from datasette.utils.asgi import Response, NotFound, Forbidden
-from graphql.error import format_error
 from graphql import graphql, print_schema
 import json
 from .utils import schema_for_database_via_cache
@@ -120,7 +119,7 @@ async def view_graphql(request, datasette):
     )
     response = {"data": result.data}
     if result.errors:
-        response["errors"] = [format_error(error) for error in result.errors]
+        response["errors"] = [error.formatted for error in result.errors]
 
     return Response.json(
         response,
diff --git a/setup.py b/setup.py
index 89c2e8f..d7c639e 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ def get_long_description():
     version=VERSION,
     packages=["datasette_graphql"],
     entry_points={"datasette": ["graphql = datasette_graphql"]},
-    install_requires=["datasette>=0.58.1", "graphene>=3.0,<4.0", "sqlite-utils"],
+    install_requires=["datasette>=0.58.1", "graphene>=3.1.0,<4.0", "graphql-core>=3.2.1", "sqlite-utils"],
     extras_require={"test": ["pytest", "pytest-asyncio"]},
     package_data={
         "datasette_graphql": ["templates/*.html", "static/*.js", "static/*.css"]


Test patch:
diff --git a/tests/test_graphql.py b/tests/test_graphql.py
index e5bafe7..a2c4d99 100644
--- a/tests/test_graphql.py
+++ b/tests/test_graphql.py
@@ -125,7 +125,6 @@ async def test_query_fields(ds):
                 {
                     "message": "Unknown argument 'search' on field 'Query.users'.",
                     "locations": [{"line": 2, "column": 23}],
-                    "path": None,
                 }
             ],
         ),
@@ -185,7 +184,6 @@ async def test_graphql_error(ds):
             {
                 "message": "Cannot query field 'nam2' on type 'users'. Did you mean 'name'?",
                 "locations": [{"line": 4, "column": 25}],
-                "path": None,
             }
         ],
     }
@@ -349,7 +347,7 @@ async def test_graphql_output_schema(ds):
         "type Query {",
         "input IntegerOperations {",
         "users(\n",
-        "filter: [usersFilter] = null",
+        "filter: [usersFilter]",
         "): usersCollection",
         "users_row(\n",
         "type _1_images {",
@@ -393,16 +391,7 @@ async def test_cors_headers(db_path, cors_enabled):
         (
             "",
             500,
-            {
-                "data": None,
-                "errors": [
-                    {
-                        "message": "Unknown operation named ''.",
-                        "locations": None,
-                        "path": None,
-                    }
-                ],
-            },
+            {"data": None, "errors": [{"message": "Unknown operation named ''."}]},
         ),
     ],
 )