Skip to content

Commit 1d1b9e8

Browse files
authored
Merge pull request #646 from dulmandakh/graphiql-0.13.0
bump graphiql to 0.13.0, and rename __debug to _debug
2 parents 74263b2 + 49aedf1 commit 1d1b9e8

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

docs/debug.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For use the Django Debug plugin in Graphene:
1515

1616
* Add ``graphene_django.debug.DjangoDebugMiddleware`` into ``MIDDLEWARE`` in the ``GRAPHENE`` settings.
1717

18-
* Add the ``debug`` field into the schema root ``Query`` with the value ``graphene.Field(DjangoDebug, name='__debug')``.
18+
* Add the ``debug`` field into the schema root ``Query`` with the value ``graphene.Field(DjangoDebug, name='_debug')``.
1919

2020

2121
.. code:: python
@@ -24,7 +24,7 @@ For use the Django Debug plugin in Graphene:
2424
2525
class Query(graphene.ObjectType):
2626
# ...
27-
debug = graphene.Field(DjangoDebug, name='__debug')
27+
debug = graphene.Field(DjangoDebug, name='_debug')
2828
2929
schema = graphene.Schema(query=Query)
3030
@@ -59,11 +59,11 @@ the GraphQL request, like:
5959
}
6060
}
6161
# Here is the debug field that will output the SQL queries
62-
__debug {
62+
_debug {
6363
sql {
6464
rawSql
6565
}
6666
}
6767
}
6868
69-
Note that the ``__debug`` field must be the last field in your query.
69+
Note that the ``_debug`` field must be the last field in your query.

examples/cookbook-plain/cookbook/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Query(cookbook.ingredients.schema.Query,
99
cookbook.recipes.schema.Query,
1010
graphene.ObjectType):
11-
debug = graphene.Field(DjangoDebug, name='__debug')
11+
debug = graphene.Field(DjangoDebug, name='_debug')
1212

1313

1414
schema = graphene.Schema(query=Query)

examples/cookbook/cookbook/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Query(cookbook.ingredients.schema.Query,
99
cookbook.recipes.schema.Query,
1010
graphene.ObjectType):
11-
debug = graphene.Field(DjangoDebug, name='__debug')
11+
debug = graphene.Field(DjangoDebug, name='_debug')
1212

1313

1414
schema = graphene.Schema(query=Query)

graphene_django/debug/tests/test_query.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Meta:
3131

3232
class Query(graphene.ObjectType):
3333
reporter = graphene.Field(ReporterType)
34-
debug = graphene.Field(DjangoDebug, name="__debug")
34+
debug = graphene.Field(DjangoDebug, name="_debug")
3535

3636
def resolve_reporter(self, info, **args):
3737
return Reporter.objects.first()
@@ -41,7 +41,7 @@ def resolve_reporter(self, info, **args):
4141
reporter {
4242
lastName
4343
}
44-
__debug {
44+
_debug {
4545
sql {
4646
rawSql
4747
}
@@ -50,7 +50,7 @@ def resolve_reporter(self, info, **args):
5050
"""
5151
expected = {
5252
"reporter": {"lastName": "ABA"},
53-
"__debug": {
53+
"_debug": {
5454
"sql": [{"rawSql": str(Reporter.objects.order_by("pk")[:1].query)}]
5555
},
5656
}
@@ -75,7 +75,7 @@ class Meta:
7575

7676
class Query(graphene.ObjectType):
7777
all_reporters = graphene.List(ReporterType)
78-
debug = graphene.Field(DjangoDebug, name="__debug")
78+
debug = graphene.Field(DjangoDebug, name="_debug")
7979

8080
def resolve_all_reporters(self, info, **args):
8181
return Reporter.objects.all()
@@ -85,7 +85,7 @@ def resolve_all_reporters(self, info, **args):
8585
allReporters {
8686
lastName
8787
}
88-
__debug {
88+
_debug {
8989
sql {
9090
rawSql
9191
}
@@ -94,7 +94,7 @@ def resolve_all_reporters(self, info, **args):
9494
"""
9595
expected = {
9696
"allReporters": [{"lastName": "ABA"}, {"lastName": "Griffin"}],
97-
"__debug": {"sql": [{"rawSql": str(Reporter.objects.all().query)}]},
97+
"_debug": {"sql": [{"rawSql": str(Reporter.objects.all().query)}]},
9898
}
9999
schema = graphene.Schema(query=Query)
100100
result = schema.execute(
@@ -117,7 +117,7 @@ class Meta:
117117

118118
class Query(graphene.ObjectType):
119119
all_reporters = DjangoConnectionField(ReporterType)
120-
debug = graphene.Field(DjangoDebug, name="__debug")
120+
debug = graphene.Field(DjangoDebug, name="_debug")
121121

122122
def resolve_all_reporters(self, info, **args):
123123
return Reporter.objects.all()
@@ -131,7 +131,7 @@ def resolve_all_reporters(self, info, **args):
131131
}
132132
}
133133
}
134-
__debug {
134+
_debug {
135135
sql {
136136
rawSql
137137
}
@@ -145,9 +145,9 @@ def resolve_all_reporters(self, info, **args):
145145
)
146146
assert not result.errors
147147
assert result.data["allReporters"] == expected["allReporters"]
148-
assert "COUNT" in result.data["__debug"]["sql"][0]["rawSql"]
148+
assert "COUNT" in result.data["_debug"]["sql"][0]["rawSql"]
149149
query = str(Reporter.objects.all()[:1].query)
150-
assert result.data["__debug"]["sql"][1]["rawSql"] == query
150+
assert result.data["_debug"]["sql"][1]["rawSql"] == query
151151

152152

153153
def test_should_query_connectionfilter():
@@ -166,7 +166,7 @@ class Meta:
166166
class Query(graphene.ObjectType):
167167
all_reporters = DjangoFilterConnectionField(ReporterType, fields=["last_name"])
168168
s = graphene.String(resolver=lambda *_: "S")
169-
debug = graphene.Field(DjangoDebug, name="__debug")
169+
debug = graphene.Field(DjangoDebug, name="_debug")
170170

171171
def resolve_all_reporters(self, info, **args):
172172
return Reporter.objects.all()
@@ -180,7 +180,7 @@ def resolve_all_reporters(self, info, **args):
180180
}
181181
}
182182
}
183-
__debug {
183+
_debug {
184184
sql {
185185
rawSql
186186
}
@@ -194,6 +194,6 @@ def resolve_all_reporters(self, info, **args):
194194
)
195195
assert not result.errors
196196
assert result.data["allReporters"] == expected["allReporters"]
197-
assert "COUNT" in result.data["__debug"]["sql"][0]["rawSql"]
197+
assert "COUNT" in result.data["_debug"]["sql"][0]["rawSql"]
198198
query = str(Reporter.objects.all()[:1].query)
199-
assert result.data["__debug"]["sql"][1]["rawSql"] == query
199+
assert result.data["_debug"]["sql"][1]["rawSql"] == query

graphene_django/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def instantiate_middleware(middlewares):
5151

5252

5353
class GraphQLView(View):
54-
graphiql_version = "0.11.11"
54+
graphiql_version = "0.13.0"
5555
graphiql_template = "graphene/graphiql.html"
5656

5757
schema = None

0 commit comments

Comments
 (0)