diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index a733c03..139c6f6 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- - name: Set up Python 3.10
+ - name: Set up Python 3.11
uses: actions/setup-python@v4
with:
- python-version: '3.10'
+ python-version: '3.11'
- name: Build wheel and source tarball
run: |
pip install wheel
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 8cee90a..bfafa67 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -8,10 +8,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- - name: Set up Python 3.10
+ - name: Set up Python 3.11
uses: actions/setup-python@v4
with:
- python-version: '3.10'
+ python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 31b479e..2c5b755 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -13,6 +13,8 @@ jobs:
include:
- django: "3.2"
python-version: "3.7"
+ - django: "4.1"
+ python-version: "3.11"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index adb54c7..9214d35 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,5 +1,5 @@
default_language_version:
- python: python3.10
+ python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
diff --git a/graphene_django/converter.py b/graphene_django/converter.py
index 9ad6c9d..375d683 100644
--- a/graphene_django/converter.py
+++ b/graphene_django/converter.py
@@ -96,7 +96,12 @@ def convert_choices_to_named_enum_with_descriptions(name, choices):
def description(self):
return str(named_choices_descriptions[self.name])
- return_type = Enum(name, list(named_choices), type=EnumWithDescriptionsType)
+ return_type = Enum(
+ name,
+ list(named_choices),
+ type=EnumWithDescriptionsType,
+ description="An enumeration.", # Temporary fix until https://github.com/graphql-python/graphene/pull/1502 is merged
+ )
return return_type
diff --git a/graphene_django/static/graphene_django/graphiql.js b/graphene_django/static/graphene_django/graphiql.js
index 5b9d96d..901c991 100644
--- a/graphene_django/static/graphene_django/graphiql.js
+++ b/graphene_django/static/graphene_django/graphiql.js
@@ -6,6 +6,7 @@
React,
ReactDOM,
graphqlWs,
+ GraphiQLPluginExplorer,
fetch,
history,
location,
@@ -98,24 +99,44 @@
function updateURL() {
history.replaceState(null, null, locationQuery(parameters));
}
- var options = {
- fetcher: graphQLFetcher,
- onEditQuery: onEditQuery,
- onEditVariables: onEditVariables,
- onEditOperationName: onEditOperationName,
- isHeadersEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled,
- shouldPersistHeaders: GRAPHENE_SETTINGS.graphiqlShouldPersistHeaders,
- query: parameters.query,
- };
- if (parameters.variables) {
- options.variables = parameters.variables;
- }
- if (parameters.operation_name) {
- options.operationName = parameters.operation_name;
+
+ function GraphiQLWithExplorer() {
+ var [query, setQuery] = React.useState(parameters.query);
+
+ function handleQuery(query) {
+ setQuery(query);
+ onEditQuery(query);
+ }
+
+ var explorerPlugin = GraphiQLPluginExplorer.useExplorerPlugin({
+ query: query,
+ onEdit: handleQuery,
+ });
+
+ var options = {
+ fetcher: graphQLFetcher,
+ plugins: [explorerPlugin],
+ defaultEditorToolsVisibility: true,
+ onEditQuery: handleQuery,
+ onEditVariables: onEditVariables,
+ onEditOperationName: onEditOperationName,
+ isHeadersEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled,
+ shouldPersistHeaders: GRAPHENE_SETTINGS.graphiqlShouldPersistHeaders,
+ query: query,
+ };
+ if (parameters.variables) {
+ options.variables = parameters.variables;
+ }
+ if (parameters.operation_name) {
+ options.operationName = parameters.operation_name;
+ }
+
+ return React.createElement(GraphiQL, options);
}
+
// Render