Commit Graph

65 Commits

Author SHA1 Message Date
Kien Dang
feb7252b8a
Add support for validation rules (#1475)
* Add support for validation rules

* Enable customizing validate max_errors through settings

* Add tests for validation rules

* Add examples for validation rules

* Allow setting validation_rules in class def

* Add tests for validation_rules inherited from parent class

* Make tests for validation rules stricter
2023-12-20 12:48:45 +03:00
danthewildcat
e735f5dbdb
Optimize views (#1439)
* Optimize execute_graphql_request

* Require operation_ast to be found by view handler

* Remove unused show_graphiql kwarg

* Old style if syntax

* Revert "Remove unused show_graphiql kwarg"

This reverts commit 33b3426092.

* Add missing schema validation step

* Pass args directly to improve clarity

* Remove duplicated operation_ast not None check

---------

Co-authored-by: Firas Kafri <3097061+firaskafri@users.noreply.github.com>
Co-authored-by: Kien Dang <mail@kien.ai>
2023-10-29 23:42:27 +08:00
mnasiri
83d3d27f14
Fix graphiql explorer styles by sending graphiql_plugin_explorer_css_sri param to render_graphiql function of the GraphQlView (#1418) (#1460) 2023-09-14 00:26:18 +08:00
Romain Létendart
ee7560f629
Support displaying deprecated input fields in GraphiQL docs (#1458)
* Update GraphiQL docs URL in docs/settings

And deduplicate link declaration.

* Support displaying deprecated input fields in GraphiQL docs
2023-09-13 09:49:01 +03:00
Kien Dang
9a773b9d7b
Use ruff in pre-commit (#1441)
* Use ruff in pre-commit

* Add pyupgrade

* Add isort

* Add bugbear

* Fix B015 Pointless comparison

* Fix B026

* B018 false positive

* Remove flake8 and isort config from setup.cfg

* Remove black and flake8 from dev dependencies

* Update black

* Show list of fixes applied with autofix on

* Fix typo

* Add C4 flake8-comprehensions

* Add ruff to dev dependencies

* Fix up
2023-08-06 01:47:00 +03:00
Steven DeMartini
520ddeabf6
Fix graphiql explorer styles by including official CSS, and update local example app for testing (#1418)
* Add venv and .venv to gitignore since common venv paths

* Update cookbook-plain app requirements and local-dev notes

This also adds the DEFAULT_AUTO_FIELD to the app's Django settings to
resolve this warning when running `migrate`:

```
ingredients.Category: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the IngredientsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
```

* Fix #1417 graphiql explorer styles by including official CSS

Like in the official graphiql-plugin-explorer example here
6198646919/packages/graphiql-plugin-explorer/examples/index.html (L26-L29)

Resolves https://github.com/graphql-python/graphene-django/issues/1417

* Update GraphiQL version

---------

Co-authored-by: Steven DeMartini <sjdemartini@users.noreply.github.com>
Co-authored-by: Kien Dang <mail@kien.ai>
2023-06-02 11:48:53 +03:00
Mykhailo Havelia
388ca41d64
fix: use execution_context_class attribute for GraphQLView (#1398)
* fix: use execution_context_class attribute for GraphQLView
2023-05-24 15:54:44 +03:00
shukryzablah
09f9b6d2f1
Remove redundant call to validate (#1393)
* Remove redundant call to validate

The call to `validate` in the django view is redundant with the validation call in graphql-core.

* Remove whitespace

---------

Co-authored-by: Firas K <3097061+firaskafri@users.noreply.github.com>
2023-05-05 13:04:22 +03:00
Kien Dang
52f992183f
Add GraphiQL Explorer plugin (#1397) 2023-05-04 22:06:10 +03:00
Kien Dang
3283d0b1be Update GraphiQL to 2.4.1 2023-04-17 09:17:21 +03:00
Kien Dang
d18cab8aa4 Update graphiql to 1.4.7 2022-12-25 01:09:13 +03:00
Nikolai Røed Kristiansen
4517e32224
👷 Add pre-commit (#1336)
* 🔧 Add pre-commit config

Similar to graphene and graphene-sqlalchemy

* ⬆ Bump black

* 👷 Lint on CI

* ⬆ Bump flake8-black

* 🔧 Keep excluding migrations

* ⬆ Bump flake8

* 🔧 Remove black and flake8 from tox config

* ⬆ Update pre-commit versions

* Upgrade syntax to python 3.7+

* Format with pre-commit

dedent docs/schema.py to allow formatting

* Fix tests on python 3.7
2022-10-19 17:10:30 +03:00
Suyeol Jeon
a78114ada3
Add support to persist GraphQL headers in GraphiQL (#1209) 2022-09-24 17:41:14 +03:00
Nikolai Røed Kristiansen
5f1731dca3
Fix: Use .formatted instead of format_error (#1327) & Fix tests
* 👽 Use .formatted instead of format_error

*  Fix test with newer graphene

null default values (graphql-python/graphene@03277a5)
no more trailing newlines
2022-08-15 11:41:39 +02:00
Rainshaw
623d0f219e
update js version (#1188) 2021-04-20 23:05:46 -07:00
Kuba Misiorny
3cf940d0c8
Add ability to pass execution_context_class to GraphQLView.as_view() (#1109)
* Add ability to pass `execution_context_class` to `GraphQLView.as_view()`

Currently when passing `execution_context_class` like this:

```
GraphQLView.as_view(execution_context_class=CustomContext)
```

you get the following error from `View.as_view()`
```
TypeError: GraphQLView() received an invalid keyword 'execution_context_class'. as_view only accepts arguments that are already attributes of the class.
```

this PR fixes the `hasattr` check in `.as_view`.

Fixes: #1072

* make black happy

removed whitespace
2021-03-31 10:31:20 -07:00
Jason Kraus
c049ab7470
WIP: Merge master into v3 (#1086)
* merge master into v3

* fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor

* fix linting by removing duplicate defintion and test of convert_form_field_to_string_list
2020-12-30 15:37:57 -08:00
Jonathan Kim
33c6a54414 Merge branch 'master' into v3 2020-08-12 07:06:35 +01:00
Radosław Kowalski
55769e814f
Add headers support to GraphiQL (#1016)
Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-08-07 10:13:26 +01:00
Jonathan Kim
6cfcddac5a Merge branch 'master' into v3 2020-08-06 20:35:08 +01:00
Eric Abruzzese
057b491176
GraphiQL cleanup (#1002)
* Add integrity checks for GraphiQL CDN resources

Also fixes an erroneous assignment preventing a setting from getting to
the UI.

* Pass SRIs and new versions to the template

* Update hashes

* Use SRI-stable artifacts for GraphiQL resources
2020-07-12 12:48:12 -07:00
Eric Abruzzese
6aa6aaaa8c
Update GraphiQL, add GraphiQL subscription support (#1001) 2020-07-12 14:42:31 +01:00
Jonathan Kim
9b41472922 Merge branch 'master' into v3 2020-05-09 12:50:39 +01:00
Marc Simon
975f45ed1a
GraphQlView: Do not 'instantiate_middleware' if middleware is already a MiddlewareManager (#952) 2020-05-09 12:15:16 +01:00
Jean-Louis Fuchs
10d22de98e
graphql 3.0 and graphene 3.0 final rebase (#951) 2020-05-09 12:13:47 +01:00
Ülgen Sarıkavak
dd0d6ef28f
Python 3 (#904)
* Remove Python 2 support

* Upgrade Python & Django versions

* Remove unsupported Django versions
* Remove unsupported Python versions
* Add Python 3.8

* Drop support for django-filter < 2

* Update LoginRequiredMixin doc link

* Remove redundant import

* Resolve RemovedInDjango40Warning warnings

* gql/graphene-django/graphene_django/tests/test_converter.py:175:
RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is
deprecated in favor of django.utils.translation.gettext_lazy().

* graphene-django/graphene_django/utils/utils.py:28:
RemovedInDjango40Warning: force_text() is deprecated in favor of
force_str().

* No need to use unicode strings with Python3

* Remove singledispatch dependency

singledispatch is inluded with Python >= 3.4, no need for external
package.
2020-04-06 13:21:07 +01:00
Sergey Fursov
aeb04d5b5c
use actual root/variables/context args of the execute method (#878) 2020-02-23 09:50:40 +00:00
Gilly Ames
4f21750fc2 Upgrade graphiql version to fix history tool (#772)
Graphiql has a history tool that allows you to save and label favourites, but this version has a bug (fixed https://github.com/graphql/graphiql/issues/750). This change upgrades to the latest version.
2019-09-22 20:43:46 +01:00
Paul Hallett
b0cba398a1
Merge pull request #647 from dulmandakh/react-16.8.6
bump react to 16.8.6
2019-05-21 14:18:45 +01:00
Dulmandakh
7690c2c002 bump react to 16.8.6 2019-05-20 19:41:25 +08:00
Dulmandakh
49aedf171a bump graphiql to 0.13.0, and rename __debug to _debug due to __ limitations 2019-05-20 17:48:28 +08:00
zorig
ba64bceab0 graphiql version upgrade 2019-05-15 17:22:29 +08:00
Paul Hallett
e6ad5887ca
Introduce Black formatting, additional tests 2019-05-02 17:46:35 +01:00
Dan Palmer
219005952a
Don't execute on GET for GraphiQL
We can also now return GraphiQL earlier in the request handling.
2018-08-30 19:29:33 +01:00
Syrus Akbary
54ef52e1c6 Reformatted files using black 2018-07-19 16:52:24 -07:00
Syrus Akbary
a65f786ba4 Fixed requirement 2018-06-05 12:31:25 -07:00
Syrus Akbary
33c6fdf5ab Added graphql-core min version to requirements 2018-06-05 01:24:53 -07:00
Syrus Akbary
70dffa94e7
Merge pull request #212 from maqquettex/fix_cbv_inheritance
Inheritance support for GraphQLView (class attributes)
2018-03-29 23:19:29 -07:00
Syrus Akbary
dbd3957a9f
Merge pull request #340 from urbandove/qfactor
Fix qfactor rankings for HTTP-ACCEPT
2018-02-11 14:01:18 -08:00
Anton Zhdan-Pushkin
2cb3d4b68e Class attributes for GraphQLView (schema, pretty, graphiql, batch) 2018-02-01 16:39:06 +02:00
Jonathan Kim
cf35f7c76c Upgrade graphiql and react versions 2018-02-01 10:01:05 +00:00
=
28cccb49f7 add saces for linter 2017-12-18 11:40:19 -05:00
=
6da95d72ea Rename [html/json]_index to _priority 2017-12-16 19:32:01 -05:00
=
6008cb6de4 Fix qfactor rankings for HTTP-ACCEPT 2017-12-11 21:08:42 -05:00
Syrus Akbary
670437d756
Merge branch 'master' into patch-1 2017-11-14 21:05:47 -08:00
Syrus Akbary
5051d3bb61 Fixed lint 2017-10-25 10:54:13 -07:00
Ivan Belokobylskiy
459d7df42b Access to batch endpoint without parameters fixed
ValueError: max() arg is an empty sequence exception fixed
2017-09-27 18:46:32 +03:00
Kuan
2790f3bc02 Updated graphiql version for new versions 2017-07-13 15:14:06 -07:00
Syrus Akbary
0588f89b89 Merge pull request #148 from khankuan/patch-2
Fix graphiql refreshing operationName undefined
2017-06-28 20:53:32 -07:00
Kuan
8eb881e085 Fix graphiql refreshing operationName undefined
operationName is serialized into the query string as a string. When getting the query value for operationName, we need to convert string "null" into None.
2017-04-13 10:11:10 -07:00