Skip to content

Commit f32f322

Browse files
Support displaying deprecated input fields in GraphiQL docs
1 parent e849486 commit f32f322

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

docs/settings.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,21 @@ Default: ``False``
237237
}
238238
239239
240+
``GRAPHIQL_INPUT_VALUE_DEPRECATION``
241+
------------------------------------
242+
243+
Set to ``True`` if you want GraphiQL to display a deprecation section on field doc view.
244+
245+
This setting is passed to ``inputValueDeprecation`` GraphiQL options, for details refer to GraphiQLDocs_.
246+
Make sure your GraphQL server supports deprecation of input values before setting this to ``True``.
247+
248+
Default: ``False``
249+
250+
.. code:: python
251+
252+
GRAPHENE = {
253+
'GRAPHIQL_INPUT_VALUE_DEPRECATION': False,
254+
}
255+
256+
240257
.. _GraphiQLDocs: https://graphiql-test.netlify.app/typedoc/modules/graphiql_react#graphiqlprovider-2

graphene_django/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
# https://github.com/graphql/graphiql/tree/main/packages/graphiql#options
4141
"GRAPHIQL_HEADER_EDITOR_ENABLED": True,
4242
"GRAPHIQL_SHOULD_PERSIST_HEADERS": False,
43+
"GRAPHIQL_INPUT_VALUE_DEPRECATION": False,
4344
"ATOMIC_MUTATIONS": False,
4445
"TESTING_ENDPOINT": "/graphql",
4546
}

graphene_django/static/graphene_django/graphiql.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
onEditOperationName: onEditOperationName,
123123
isHeadersEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled,
124124
shouldPersistHeaders: GRAPHENE_SETTINGS.graphiqlShouldPersistHeaders,
125+
inputValueDeprecation: GRAPHENE_SETTINGS.graphiqlInputValueDeprecation,
125126
query: query,
126127
};
127128
if (parameters.variables) {

graphene_django/templates/graphene/graphiql.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
{% endif %}
5555
graphiqlHeaderEditorEnabled: {{ graphiql_header_editor_enabled|yesno:"true,false" }},
5656
graphiqlShouldPersistHeaders: {{ graphiql_should_persist_headers|yesno:"true,false" }},
57+
graphiqlInputValueDeprecation: {{ graphiql_input_value_deprecation|yesno:"true,false" }},
5758
};
5859
</script>
5960
<script src="{% static 'graphene_django/graphiql.js' %}"></script>

graphene_django/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def dispatch(self, request, *args, **kwargs):
172172
# GraphiQL headers tab,
173173
graphiql_header_editor_enabled=graphene_settings.GRAPHIQL_HEADER_EDITOR_ENABLED,
174174
graphiql_should_persist_headers=graphene_settings.GRAPHIQL_SHOULD_PERSIST_HEADERS,
175+
graphiql_input_value_deprecation=graphene_settings.GRAPHIQL_INPUT_VALUE_DEPRECATION,
175176
)
176177

177178
if self.batch:

0 commit comments

Comments
 (0)