From 17f6a45a47ba2bcf16c0d70a0078ea0a9f5af7b8 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 22:37:32 -0700 Subject: [PATCH 1/7] Update unions.rst --- docs/types/unions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/types/unions.rst b/docs/types/unions.rst index 2c5c5a75..16ac24e8 100644 --- a/docs/types/unions.rst +++ b/docs/types/unions.rst @@ -7,7 +7,7 @@ to specify any common fields between the types. The basics: - Each Union is a Python class that inherits from ``graphene.Union``. -- Unions don't have any fields on it, just links to the possible objecttypes. +- Unions don't have any fields on it, just links to the possible ObjectTypes. Quick example ------------- From 5acd04aa93a38bd7415aa33e4c593560420bc2e7 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 22:40:08 -0700 Subject: [PATCH 2/7] Update mutations.rst --- docs/types/mutations.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/types/mutations.rst b/docs/types/mutations.rst index f8c76f35..73866063 100644 --- a/docs/types/mutations.rst +++ b/docs/types/mutations.rst @@ -85,9 +85,9 @@ We should receive: InputFields and InputObjectTypes ---------------------------------- -InputFields are used in mutations to allow nested input data for mutations +InputFields are used in mutations to allow nested input data for mutations. -To use an InputField you define an InputObjectType that specifies the structure of your input data +To use an InputField you define an InputObjectType that specifies the structure of your input data: .. code:: python @@ -112,7 +112,7 @@ To use an InputField you define an InputObjectType that specifies the structure return CreatePerson(person=person) -Note that **name** and **age** are part of **person_data** now +Note that **name** and **age** are part of **person_data** now. Using the above mutation your new query would look like this: @@ -128,7 +128,7 @@ Using the above mutation your new query would look like this: } InputObjectTypes can also be fields of InputObjectTypes allowing you to have -as complex of input data as you need +as complex of input data as you need: .. code:: python @@ -160,7 +160,7 @@ To return an existing ObjectType instead of a mutation-specific type, set the ** def mutate(root, info, name): return Person(name=name) -Then, if we query (``schema.execute(query_str)``) the following: +Then, if we query (``schema.execute(query_str)``) with the following: .. code:: From a5fbb2e9e5a7b5cce1d7e017cfcb40b09f5bbc50 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 22:44:41 -0700 Subject: [PATCH 3/7] Update middleware.rst --- docs/execution/middleware.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/execution/middleware.rst b/docs/execution/middleware.rst index 0c5458b2..c0a8c792 100644 --- a/docs/execution/middleware.rst +++ b/docs/execution/middleware.rst @@ -46,7 +46,7 @@ Functional example ------------------ Middleware can also be defined as a function. Here we define a middleware that -logs the time it takes to resolve each field +logs the time it takes to resolve each field: .. code:: python From 3ed8273239dfcf21fd1a0c00d1658e4cd6ced322 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 22:48:53 -0700 Subject: [PATCH 4/7] Update dataloader.rst --- docs/execution/dataloader.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/execution/dataloader.rst b/docs/execution/dataloader.rst index 3f693075..d2ab012a 100644 --- a/docs/execution/dataloader.rst +++ b/docs/execution/dataloader.rst @@ -28,10 +28,9 @@ Create loaders by providing a batch loading function. A batch loading function accepts a list of keys, and returns a ``Promise`` which resolves to a list of ``values``. -Then load individual values from the loader. ``DataLoader`` will coalesce all -individual loads which occur within a single frame of execution (executed once -the wrapping promise is resolved) and then call your batch function with all -requested keys. +``DataLoader`` will coalesce all individual loads which occur within a +single frame of execution (executed once the wrapping promise is resolved) +and then call your batch function with all requested keys. .. code:: python @@ -96,7 +95,7 @@ Consider the following GraphQL request: } -Naively, if ``me``, ``bestFriend`` and ``friends`` each need to request the backend, +If ``me``, ``bestFriend`` and ``friends`` each need to send a request to the backend, there could be at most 13 database requests! From db9d9a08f2cf07311ab172820c893011a687c7c2 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 23:01:20 -0700 Subject: [PATCH 5/7] Update schema.rst --- docs/types/schema.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/types/schema.rst b/docs/types/schema.rst index 08ff27d0..c98684b7 100644 --- a/docs/types/schema.rst +++ b/docs/types/schema.rst @@ -44,7 +44,7 @@ There are some cases where the schema cannot access all of the types that we pla For example, when a field returns an ``Interface``, the schema doesn't know about any of the implementations. -In this case, we need to use the ``types`` argument when creating the Schema. +In this case, we need to use the ``types`` argument when creating the Schema: .. code:: python @@ -63,7 +63,7 @@ By default all field and argument names (that are not explicitly set with the ``name`` arg) will be converted from ``snake_case`` to ``camelCase`` (as the API is usually being consumed by a js/mobile client) -For example with the ObjectType +For example with the ObjectType the ``last_name`` field name is converted to ``lastName``: .. code:: python @@ -71,12 +71,12 @@ For example with the ObjectType last_name = graphene.String() other_name = graphene.String(name='_other_Name') -the ``last_name`` field name is converted to ``lastName``. + In case you don't want to apply this transformation, provide a ``name`` argument to the field constructor. ``other_name`` converts to ``_other_Name`` (without further transformations). -Your query should look like +Your query should look like: .. code:: @@ -86,7 +86,7 @@ Your query should look like } -To disable this behavior, set the ``auto_camelcase`` to ``False`` upon schema instantiation. +To disable this behavior, set the ``auto_camelcase`` to ``False`` upon schema instantiation: .. code:: python From 12302b78f997669f84300ebc9058ff5380e43ca9 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 23:08:42 -0700 Subject: [PATCH 6/7] Update schema.rst --- docs/types/schema.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/types/schema.rst b/docs/types/schema.rst index c98684b7..a82addc9 100644 --- a/docs/types/schema.rst +++ b/docs/types/schema.rst @@ -71,8 +71,6 @@ For example with the ObjectType the ``last_name`` field name is converted to ``l last_name = graphene.String() other_name = graphene.String(name='_other_Name') - - In case you don't want to apply this transformation, provide a ``name`` argument to the field constructor. ``other_name`` converts to ``_other_Name`` (without further transformations). From 002b769db4309b6d86c840a4b9277758be362653 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 12 Apr 2021 23:32:11 -0700 Subject: [PATCH 7/7] Fixing Dataloader docs due to tox issue. --- docs/execution/dataloader.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/execution/dataloader.rst b/docs/execution/dataloader.rst index d2ab012a..8a8e2ae3 100644 --- a/docs/execution/dataloader.rst +++ b/docs/execution/dataloader.rst @@ -28,8 +28,8 @@ Create loaders by providing a batch loading function. A batch loading function accepts a list of keys, and returns a ``Promise`` which resolves to a list of ``values``. -``DataLoader`` will coalesce all individual loads which occur within a -single frame of execution (executed once the wrapping promise is resolved) +``DataLoader`` will coalesce all individual loads which occur within a +single frame of execution (executed once the wrapping promise is resolved) and then call your batch function with all requested keys.