Commit Graph

964 Commits

Author SHA1 Message Date
belkka
b274a607f4
Avoid ambiguity in graphene.Mutation docstring
The code example in docstring starts with `from graphene import Mutation` and defines a `class Mutation` later. This definition would shadow previously imported name and (which is more important) confuses a reader about usage of this class — one need to keep in mind that previous usage of `Mutation` is imported from graphene and have not been overridden yet.

This PR changes an import-from statement to an import statement, so `graphene.Mutation` is used explicitly. This approach is consistent with other code examples in docs (e. g. https://docs.graphene-python.org/en/v2.1.9/types/mutations/).

Another option is to change name of example class Mutation to something more clear (maybe SchemaMutation or RootMutation), but I'm not sure what name to choose.

Only docstring is updated, no code changes.
2021-10-11 23:46:13 +03:00
Eran Kampf
0a54094f59
v3.0.0b8 2021-09-29 23:42:36 -07:00
Aryan Iyappan
47696559c7 run linters locally 2021-08-24 08:30:54 +05:30
Aryan Iyappan
2e5944eb20 format code 2021-08-22 11:03:22 +05:30
Aryan Iyappan
1c3054b7c8
Update test_connection_async.py 2021-08-21 21:01:27 +05:30
Aryan Iyappan
5896ade2dd
Update test_connection_query.py 2021-08-21 20:58:18 +05:30
Aryan Iyappan
1886ec9dcb
Update schema.py 2021-08-21 18:34:39 +05:30
Aryan Iyappan
0ebff3313d
Update test_schema.py 2021-08-21 18:30:42 +05:30
Aryan Iyappan
7827219ba2
Update schema.py 2021-08-21 18:29:56 +05:30
Aryan Iyappan
74a6565ea3
Update depth_limit.py 2021-08-20 21:07:57 +05:30
Aryan Iyappan
98980b53f6
Update depth_limit.py 2021-08-20 21:04:22 +05:30
Aryan Iyappan
57a4394bf3
Update depth_limit.py 2021-08-20 20:56:19 +05:30
Aryan Iyappan
ea4e6d65e9
Update schema.py 2021-08-20 16:08:58 +05:30
Aryan Iyappan
18cd3451f9
Update test_schema.py 2021-08-20 15:59:38 +05:30
Aryan Iyappan
946c2a3807
Update schema.py 2021-08-20 15:58:43 +05:30
Syrus Akbary
7d890bf915
Update graphene/validation/disable_introspection.py 2021-08-19 14:02:45 -05:00
Aryan Iyappan
b4be4a686b add notice to failing tests 2021-08-19 10:59:58 +05:30
Aryan Iyappan
4e32dac251 add tests and docs for disable introspection rule 2021-08-14 08:41:24 +05:30
Aryan Iyappan
ac5dd90f5f fix typo in docs 2021-08-14 07:54:58 +05:30
Aryan Iyappan
d7b474751d add depth limit validator tests 2021-08-14 07:45:34 +05:30
Aryan Iyappan
a784ef15e5 add disable introspection 2021-08-13 20:24:53 +05:30
Aryan Iyappan
fc2967e276 remove unused imports 2021-08-13 18:51:23 +05:30
Aryan Iyappan
aa11681048 add depth limit validator 2021-08-13 18:22:12 +05:30
Sergey Fedoseev
69b6286861
Fix typo in docstring of ObjectType (#1343) 2021-07-16 10:10:53 -07:00
Minh Tu Le
c08379ed85
Use argument's default_value regardless if the input field is required (#1326)
* Use argument's default value regardless if the input field is required

* Add a test

* Format code
2021-04-19 10:03:11 -07:00
Alec Rosenbaum
7004515f06 implement interface interfaces on TypeMap, fix failing test 2021-01-15 13:13:05 -05:00
Alec Rosenbaum
a17f63cf03 add failing type_map test, bar_graphql_type has no interfaces 2021-01-15 13:10:14 -05:00
Alec Rosenbaum
86b7e6ac86 update InterfaceOptions to fix failing test 2021-01-15 13:02:08 -05:00
Alec Rosenbaum
ae93499a37 add failing test for interface meta 2021-01-15 13:01:43 -05:00
Jonathan Kim
2e87ebe5fc
v3.0.0b7 2021-01-06 09:58:19 +00:00
Jason Kraus
e5eeb9d831
fix(Decimal): parse integers as decimal. (#1295) 2021-01-06 09:54:45 +00:00
Jonathan Kim
84582eb374
v3.0.0b6 2020-10-21 10:15:38 +01:00
Alec Rosenbaum
e24ac547d6
Add UnforgivingExecutionContext (#1255) 2020-10-21 10:13:32 +01:00
Paul Bailey
8c327fc4ed
add BigInt type (#1261)
* add BigInt type

* formatting

* more Int tests
2020-08-28 17:55:46 +02:00
Jonathan Kim
188ce9a6cb
Fix subscribe with arguments (#1251) 2020-08-12 14:43:35 -07:00
Jonathan Kim
29dd3f8391
v3.0.0b5 2020-08-06 17:19:02 +01:00
Syrus Akbary
d085c8852b
Subscription revamp (#1235)
* Integrate async tests into main code

* Added full support for subscriptions

* Fixed syntax using black

* Fixed typo
2020-07-28 13:33:21 -07:00
Jonathan Kim
64af43748c
v3.0.0b4 2020-07-14 14:31:54 +01:00
Jonathan Kim
81fff0f1b5
Improve enum compatibility (#1153)
* Improve enum compatibility by supporting return enum as well as values and names

* Handle invalid enum values

* Rough implementation of compat middleware

* Move enum middleware into compat module

* Fix tests

* Tweak enum examples

* Add some tests for the middleware

* Clean up tests

* Add missing imports

* Remove enum compat middleware

* Use custom dedent function and pin graphql-core to >3.1.2
2020-07-13 15:40:57 -07:00
Jonathan Kim
d042d5e95a
Expose Base64 type and add custom scalar examples (#1223) 2020-07-09 17:55:27 +01:00
Eric Rodrigues Pires
c61f0f736a
Add Base64 scalar (#1221) 2020-07-02 10:52:44 -07:00
Jonathan Kim
5b2eb1109a
ObjectType meta arguments (#1219)
* Pass extra kwargs down the meta chain

* Rename name argument to allow custom name

* Reword error message

* Explicitly define kwargs

* Revert change to explicit kwargs

* name -> name_ for Enum __new__ function
2020-06-29 15:26:08 -07:00
Jonathan Kim
ecd11ccc1e
Revert 1213 update mutation docs (#1214)
* Revert "Update requirement for Query type in mutation docs (#1213)"

This reverts commit a9625dac0e.

* Add test to check that Query type must be defined
2020-06-29 07:53:53 -07:00
Jonathan Ehwald
bf034ca85f
Rename variables called type to type_ (#1216)
Co-authored-by: Daniel Gallagher <daniellg@yelp.com>
2020-06-27 11:18:11 +01:00
Jonathan Kim
05d96a9833 v3.0.0b3 2020-06-25 17:57:42 +01:00
Jonathan Kim
a9625dac0e
Update requirement for Query type in mutation docs (#1213) 2020-06-24 19:22:22 -07:00
Jonathan Kim
a1fc3688aa
Remove to_const function (#1212) 2020-06-24 19:21:40 -07:00
Christoph Zwerschke
47c63f3dd7
Fix DateTime Scalar parse_literal methods (#1199) (#1200) 2020-06-04 21:30:23 -07:00
Jonathan Kim
df67e69129
v3.0b2 2020-05-09 13:04:05 +01:00
Syrus Akbary
49fcf9f2e6
Allow fast ObjectType creation based on dataclasses (#1157)
* Allow fast ObjectType creation based on dataclasses

* Fixed Python 3.8 integration

* Added repr and eq methods to ObjectType containers

* Reformatted code

* Fixed mypy issue

* Removed unused __init__ for ObjectType containers

* Use black in dataclasses

* Use latest black verison on precommit
2020-04-12 17:45:46 -07:00
Jonathan Kim
0051f82b5f
v3.0.0b1 2020-04-06 09:36:53 +01:00
Jonathan Kim
a2fe8dd704
Add note about the use of args (#1170)
* Add note about the use of `args`

Closes #1037

* Some improvements

* Link to correct place
2020-04-02 19:55:00 +01:00
Jonathan Kim
cb3bfe011f
Use default_resolver to resolve values when using the source at… (#1155) 2020-03-16 16:20:04 +00:00
Jonathan Kim
6f2863ef6e
Add some more tests for Interface (#1154) 2020-03-16 16:19:44 +00:00
Jonathan Kim
00e36b52d5
Remove unused function (#1160) 2020-03-16 15:51:07 +00:00
Syrus Akbary
60a9609b9a
Updated all str.format(…) to f-strings (#1158)
* Updated all str.format(…) to f-strings

This revamps the PR #984

* Pass black

* Fix flake8

* Updated objecttype

* Fix black version
2020-03-14 17:32:44 -07:00
Syrus Akbary
14183012a8
Remove subclass polyfill (#1156)
The subclass polyfill was only needed for Python 2.7-3.5

Python 3.6 introduced the __init_subclass__, so since Graphene now requires Python 3.6+, this is no longer needed.

https://www.python.org/dev/peps/pep-0487/
2020-03-14 20:19:28 +00:00
Rob Blackbourn
1cf303a27b
Added support for subscription (#1107)
* Added support for subscription

* Added pre-commit hooks for black and formatted changed files

* Checked with flake8

* Integrated changes from master.

Co-authored-by: Rob Blackbourn <rblackbourn@bhdgsystematic.com>
Co-authored-by: Rob Blackbourn <rtb@beast.jetblack.net>
2020-03-14 16:48:12 +00:00
Christoph Zwerschke
88f79b2850 Fix types in Schema docstring (#1100) 2020-03-04 15:26:09 +01:00
Christoph Zwerschke
5d97c848e0 Remove misleading comment
The comment originally referred to the __metaclass__ attribute which is gone now.
2020-03-04 12:44:53 +01:00
Christoph Zwerschke
5e6f68957e Use latest graphql-core 3.1.0b1 instead of 3.0.3
Adapt Schema, because there is no type reducer in core 3.1 any more.
2020-03-04 12:23:40 +01:00
Christoph Zwerschke
ffb7701466 Create another alpha release 2020-03-04 11:37:00 +01:00
Jonathan Kim
98e10f0db8
Replace INVALID with Undefined (#1146) 2020-02-27 20:51:59 +00:00
Jayden Windle
ac98be7836
Use Undefined instead of the now deprecated INVALID (#1143) 2020-02-26 21:18:13 +01:00
정유석
be97a369f7
fix typo in class 'Interface' (#1135) 2020-02-18 08:53:48 +00:00
James
23bb52a770
Add a helpful message to when a global_id fails to parse. (#1074)
* Add a helpful message to when a global_id fails to parse.

* Update test_node to have errors on test_node_query_incorrect_id

* Black the node.py file

* Remove func wrapper used in debugging get_resolver partial

* Update node.py

* Expand error messages

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-02-10 14:16:11 -08:00
Jean-Louis Fuchs
ad0b3a529c
The default_value of InputField should be INVALID (#1111)
* The default_value of InputField should be INVALID

Since GraphQL 3.0 there is a distinction between None and INVALID (no value).
The tests captured the bug and are updated.

* Update minimum graphql-core version

* Use Undefined instead of INVALID

Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-02-08 20:24:58 +00:00
Henry Baldursson
9a19447213 Use unidecode to handle unicode characters in constant names (#1080) 2020-02-08 09:21:25 -08:00
Jonathan Kim
bd6d8d086d
Fix tests (#1119)
* Fix tests

* Add extra folders to make test command

* Update snapshots

* Add python 3.8 to test matrix

* Add black command to makefile and black dependency to setup.py

* Add lint command

* Run format

* Remove 3.8 from test matrix

* Add Python 3.8 to test matrix

* Update setup.py
2019-12-31 14:08:30 +00:00
Theodore Diamantidis
7c7876d37c Propagate arguments of relay.NodeField to Field (#1036)
* Propagate name, deprecation_reason arguments of relay.NodeField to Field

* Allow custom description in Node.Field and move ID description to ID argument

* Add test for Node.Field with custom name

* Add tests for description, deprecation_reason arguments of NodeField

* Pass all kwargs from NodeField to Field
2019-09-27 09:54:46 +01:00
Jonathan Kim
a3b215d891
Remove AbstractType (#1053) 2019-09-27 09:54:19 +01:00
Min ho Kim
e90aa1b712 Fix typos (#1066)
Fixed typos in docs, string literals, comments, test name
2019-09-25 19:57:53 -04:00
Mel van Londen
8e7d76bbce
Graphene v3 following v3 graphql-core (#1048)
* v3.0 - remove Python 2.x from build (#983)

* Change travis to only compile for p3.6+

* Changed tox to only run Python 3.6+

* Changed library classifiers to reflect support in Python 3.6+

* Changed version to 3.0.0 development

In [15]: get_version((3, 0, 0, "alpha", 0))
Out[15]: '3.0.dev20190601212304'

* Reorganize Tests (#985)

We no longer need a dedicated folder for Python3.6+ tests
We no longer need to check six.PY3 in tests

* Upgrade black to 19.3b0 (#987)

* Remove six dependency (#986)

* No one is using func_name

* Remove six simple usages

* Remove six requirement

* Remove `six.with_metaclass` calls

* pytest-asyncio should be a regular dependency now with Py3 move

* Change dependency to graphql-core-next (#988)

* Changed dependencies to core-next

* Converted Scalars

* ResolveInfo name change

* Ignore .venv

* Make Schema compatible with GraphQL-core-next

* Ignore more venv names and mypy and pytest caches

* Remove print statements for debugging in schema test

* core-next now provides out_type and out_name

* Adapt date and time scalar types to core-next

* Ignore the non-standard result.invalid flag

* Results are named tuples in core-next (immutable)

* Enum values are returned as dict in core-next

* Fix mutation tests with promises

* Make all 345 tests pass with graphql-core-next

* Remove the compat module which was only needed for older Py version

* Remove object as base class (not needed in Py 3)

* We can assume that dicts are ordered in Py 3.6+

* Make use of the fact that dicts are iterable

* Use consistent style of importing from pytest

* Restore compatibility with graphql-relay-py v3

Add adpaters for the PageInfo and Connection args.

* Avoid various deprecation warnings

* Use graphql-core 3 instead of graphql-core-next

* Update dependencies, reformat changes with black

* Update graphene/relay/connection.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Run black on setup.py

* Remove trailing whitespace
2019-08-17 17:07:53 -04:00
Jonathan Kim
3d0e460be1 v2.1.8 (#1054)
Update version to v2.1.8
2019-08-17 16:52:59 -04:00
Ntale Shadik
c96bd680d7 Add interfaces meta argument on Mutations (#1023) 2019-07-24 18:44:22 +01:00
Jonathan Kim
167c8c203c Bump version 2019-07-15 21:09:41 +01:00
Jonathan Kim
89ca4f58a2
v2.1.6 (#1005) 2019-06-14 11:41:29 +01:00
David Anderson
da1359ecca expose livehtml autobuild in Makefile + Add API autodoc (#971)
* expose livehtml autobuild in Makefile

* add API documentation for schema

* document graphene core API

* fixes black lint

* Update graphene/types/union.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Update graphene/types/argument.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Update graphene/types/field.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* Update graphene/types/inputfield.py

Co-Authored-By: Jonathan Kim <jkimbo@gmail.com>

* add note about non-functional `interfaces` meta argument in mutation

* update with other virtual environment configuration

* pin autobuild

* format argument example code

* format enum input object and interface examples

* format enum mutation union examples

* revise documentation with imports, capitalization
2019-06-09 15:36:06 -07:00
Eran Kampf
17fbcb6746 v.2.1.5 2019-06-03 10:12:50 -07:00
Eran Kampf
40534bcce9 v2.1.4 2019-06-01 13:44:13 -07:00
David Anderson
ec9f76cfae Fix flaky date tests (#982)
* fix flaky datetime test with fixed values

* rename fixtures for clarity in date+time tests
2019-06-01 13:41:45 -07:00
Eran Kampf
eb7966eca7
Fix for metaclasses that use type annotation (Issue #979) (#981)
* Replicate error with test

* Fix - ignore parameters we do not recognize

* Seperate Python3.6+ tests to their own folder

* lint

* Unused import

* Black formatting
2019-05-31 14:31:17 -07:00
NyanKiyoshi
6a4091b3e4 from_enum can now take a deprecation reason (#957) 2019-05-06 10:17:33 -07:00
Minh Tu Le
abff3d75a3 Allow the connection node to be wrapped in a NonNull type (#934) 2019-04-12 16:29:53 -07:00
Eran Kampf
d0cfee5641
Make UUID compatible (Fixed issue #936) (#937)
* Make UUID compatible

* Fix typo

* black code formatting
2019-04-08 14:06:32 -07:00
Andreas Sodeur
7b6dae7fa3 [863] DateTime, Date, and Time now accept datetime.datetime, datetime.date,… (#864)
* DateTime, Date, and Time now accept datetime.datetime, datetime.date, and datetime.time resp. inputs when used as variables

* Added tests and improved resilience against bad DateTime, Date, and Time inputs.

* Fixed string type checks too narrow for py2.7

* fixed some of pre-commit's complaints
2019-03-31 11:57:34 +01:00
Jonathan Kim
ca9188a615 Dict or attr default resolver (#638)
* Add dict_or_attr resolver and set it as default

* Add some tests

* Dry up code

* Updated formatting
2019-03-11 10:24:11 -07:00
Dan
9ae2359b87 Run pre-commit autoupdate to bump versions of precommit hooks, then run them on all files (#913) 2019-03-08 11:09:45 -08:00
Jonathan Kim
d1b1ad733f Ignore flake8 error 2018-12-27 09:39:18 +00:00
cherls
8e53672a1d Add mutation field default arg test 2018-11-05 13:30:09 -05:00
cherls
4d5a091d16 Add default Field description as docstring 2018-11-05 13:30:05 -05:00
Dan Palmer
2a3d92682a
Add descriptions to the fields as well 2018-09-09 18:44:01 +01:00
Dan Palmer
b8ecc3929d
Add basic type documentation for Relay fields
This adds documentation in the API for `PageInfo`s and `Edges`.

This is useful to include in Graphene because `PageInfo` is always the same, and Edges always have the same format, so documentation for both can be created automatically.
2018-09-09 18:19:58 +01:00
Dan Palmer
00d370b228
Expose documentation for Union types 2018-09-08 17:20:39 +01:00
Syrus Akbary
9512528a77 Fixed async funcs 2018-08-31 20:16:12 +02:00
Syrus Akbary
3d41a500c9 Fixed lint & imports 2018-08-31 20:01:03 +02:00
Syrus Akbary
3e5319cf70 Abstract thenables (promise, coroutine) out of relay Connections and Mutations 2018-08-31 19:53:21 +02:00
Dan Palmer
baec6249e5
Fix assertion 2018-08-29 18:10:37 +01:00
Dan Palmer
07ec419578
Fix grammar 2018-08-29 17:31:46 +01:00
Adam Johnson
4f2b278e12 black reformat 2018-08-29 13:07:45 +03:00