mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-29 13:03:56 +03:00
Fix typos (#1066)
Fixed typos in docs, string literals, comments, test name
This commit is contained in:
parent
8e7d76bbce
commit
e90aa1b712
|
@ -24,7 +24,7 @@ What is Graphene?
|
||||||
|
|
||||||
Graphene is a library that provides tools to implement a GraphQL API in Python using a *code-first* approach.
|
Graphene is a library that provides tools to implement a GraphQL API in Python using a *code-first* approach.
|
||||||
|
|
||||||
Compare Graphene's *code-first* approach to building a GraphQL API with *schema-first* approaches like `Apollo Server`_ (JavaScript) or Ariadne_ (Python). Instead of writing GraphQL **Schema Definition Langauge (SDL)**, we write Python code to describe the data provided by your server.
|
Compare Graphene's *code-first* approach to building a GraphQL API with *schema-first* approaches like `Apollo Server`_ (JavaScript) or Ariadne_ (Python). Instead of writing GraphQL **Schema Definition Language (SDL)**, we write Python code to describe the data provided by your server.
|
||||||
|
|
||||||
.. _Apollo Server: https://www.apollographql.com/docs/apollo-server/
|
.. _Apollo Server: https://www.apollographql.com/docs/apollo-server/
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ The two resolvers in this example are effectively the same.
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
If you prefer your code to be more explict, feel free to use ``@staticmethod`` decorators. Otherwise, your code may be cleaner without them!
|
If you prefer your code to be more explicit, feel free to use ``@staticmethod`` decorators. Otherwise, your code may be cleaner without them!
|
||||||
|
|
||||||
.. _DefaultResolver:
|
.. _DefaultResolver:
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ GraphQL Argument defaults
|
||||||
|
|
||||||
If you define an argument for a field that is not required (and in a query
|
If you define an argument for a field that is not required (and in a query
|
||||||
execution it is not provided as an argument) it will not be passed to the
|
execution it is not provided as an argument) it will not be passed to the
|
||||||
resolver function at all. This is so that the developer can differenciate
|
resolver function at all. This is so that the developer can differentiate
|
||||||
between a ``undefined`` value for an argument and an explicit ``null`` value.
|
between a ``undefined`` value for an argument and an explicit ``null`` value.
|
||||||
|
|
||||||
For example, given this schema:
|
For example, given this schema:
|
||||||
|
|
|
@ -14,7 +14,7 @@ def setup():
|
||||||
|
|
||||||
# Yeah, technically it's Corellian. But it flew in the service of the rebels,
|
# Yeah, technically it's Corellian. But it flew in the service of the rebels,
|
||||||
# so for the purposes of this demo it's a rebel ship.
|
# so for the purposes of this demo it's a rebel ship.
|
||||||
falcon = Ship(id="4", name="Millenium Falcon")
|
falcon = Ship(id="4", name="Millennium Falcon")
|
||||||
|
|
||||||
homeOne = Ship(id="5", name="Home One")
|
homeOne = Ship(id="5", name="Home One")
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ snapshots["test_mutations 1"] = {
|
||||||
{"node": {"id": "U2hpcDox", "name": "X-Wing"}},
|
{"node": {"id": "U2hpcDox", "name": "X-Wing"}},
|
||||||
{"node": {"id": "U2hpcDoy", "name": "Y-Wing"}},
|
{"node": {"id": "U2hpcDoy", "name": "Y-Wing"}},
|
||||||
{"node": {"id": "U2hpcDoz", "name": "A-Wing"}},
|
{"node": {"id": "U2hpcDoz", "name": "A-Wing"}},
|
||||||
{"node": {"id": "U2hpcDo0", "name": "Millenium Falcon"}},
|
{"node": {"id": "U2hpcDo0", "name": "Millennium Falcon"}},
|
||||||
{"node": {"id": "U2hpcDo1", "name": "Home One"}},
|
{"node": {"id": "U2hpcDo1", "name": "Home One"}},
|
||||||
{"node": {"id": "U2hpcDo5", "name": "Peter"}},
|
{"node": {"id": "U2hpcDo5", "name": "Peter"}},
|
||||||
]
|
]
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Argument(MountedType):
|
||||||
type (class for a graphene.UnmountedType): must be a class (not an instance) of an
|
type (class for a graphene.UnmountedType): must be a class (not an instance) of an
|
||||||
unmounted graphene type (ex. scalar or object) which is used for the type of this
|
unmounted graphene type (ex. scalar or object) which is used for the type of this
|
||||||
argument in the GraphQL schema.
|
argument in the GraphQL schema.
|
||||||
required (bool): indicates this argument as not null in the graphql scehma. Same behavior
|
required (bool): indicates this argument as not null in the graphql schema. Same behavior
|
||||||
as graphene.NonNull. Default False.
|
as graphene.NonNull. Default False.
|
||||||
name (str): the name of the GraphQL argument. Defaults to parameter name.
|
name (str): the name of the GraphQL argument. Defaults to parameter name.
|
||||||
description (str): the description of the GraphQL argument in the schema.
|
description (str): the description of the GraphQL argument in the schema.
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Field(MountedType):
|
||||||
object. Alternative to resolver (cannot set both source and resolver).
|
object. Alternative to resolver (cannot set both source and resolver).
|
||||||
deprecation_reason (optional, str): Setting this value indicates that the field is
|
deprecation_reason (optional, str): Setting this value indicates that the field is
|
||||||
depreciated and may provide instruction or reason on how for clients to proceed.
|
depreciated and may provide instruction or reason on how for clients to proceed.
|
||||||
required (optional, bool): indicates this field as not null in the graphql scehma. Same behavior as
|
required (optional, bool): indicates this field as not null in the graphql schema. Same behavior as
|
||||||
graphene.NonNull. Default False.
|
graphene.NonNull. Default False.
|
||||||
name (optional, str): the name of the GraphQL field (must be unique in a type). Defaults to attribute
|
name (optional, str): the name of the GraphQL field (must be unique in a type). Defaults to attribute
|
||||||
name.
|
name.
|
||||||
|
|
|
@ -38,7 +38,7 @@ class InputField(MountedType):
|
||||||
deprecation_reason (optional, str): Setting this value indicates that the field is
|
deprecation_reason (optional, str): Setting this value indicates that the field is
|
||||||
depreciated and may provide instruction or reason on how for clients to proceed.
|
depreciated and may provide instruction or reason on how for clients to proceed.
|
||||||
description (optional, str): Description of the GraphQL field in the schema.
|
description (optional, str): Description of the GraphQL field in the schema.
|
||||||
required (optional, bool): Indicates this input field as not null in the graphql scehma.
|
required (optional, bool): Indicates this input field as not null in the graphql schema.
|
||||||
Raises a validation error if argument not provided. Same behavior as graphene.NonNull.
|
Raises a validation error if argument not provided. Same behavior as graphene.NonNull.
|
||||||
Default False.
|
Default False.
|
||||||
**extra_args (optional, Dict): Not used.
|
**extra_args (optional, Dict): Not used.
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ObjectType(BaseType):
|
||||||
have a name, but most importantly describe their fields.
|
have a name, but most importantly describe their fields.
|
||||||
|
|
||||||
The name of the type defined by an _ObjectType_ defaults to the class name. The type
|
The name of the type defined by an _ObjectType_ defaults to the class name. The type
|
||||||
description defaults to the class docstring. This can be overriden by adding attributes
|
description defaults to the class docstring. This can be overridden by adding attributes
|
||||||
to a Meta inner class.
|
to a Meta inner class.
|
||||||
|
|
||||||
The class attributes of an _ObjectType_ are mounted as instances of ``graphene.Field``.
|
The class attributes of an _ObjectType_ are mounted as instances of ``graphene.Field``.
|
||||||
|
@ -66,8 +66,8 @@ class ObjectType(BaseType):
|
||||||
docstring.
|
docstring.
|
||||||
interfaces (Iterable[graphene.Interface]): GraphQL interfaces to extend with this object.
|
interfaces (Iterable[graphene.Interface]): GraphQL interfaces to extend with this object.
|
||||||
all fields from interface will be included in this object's schema.
|
all fields from interface will be included in this object's schema.
|
||||||
possible_types (Iterable[class]): Used to test parent value object via isintance to see if
|
possible_types (Iterable[class]): Used to test parent value object via isinstance to see if
|
||||||
this type can be used to resolve an ambigous type (interface, union).
|
this type can be used to resolve an ambiguous type (interface, union).
|
||||||
default_resolver (any Callable resolver): Override the default resolver for this
|
default_resolver (any Callable resolver): Override the default resolver for this
|
||||||
type. Defaults to graphene default resolver which returns an attribute or dictionary
|
type. Defaults to graphene default resolver which returns an attribute or dictionary
|
||||||
key with the same name as the field.
|
key with the same name as the field.
|
||||||
|
|
|
@ -481,7 +481,7 @@ class Schema:
|
||||||
as string or parsed AST form from `graphql-core`.
|
as string or parsed AST form from `graphql-core`.
|
||||||
root_value (Any, optional): Value to use as the parent value object when resolving
|
root_value (Any, optional): Value to use as the parent value object when resolving
|
||||||
root types.
|
root types.
|
||||||
context_value (Any, optional): Value to be made avaiable to all resolvers via
|
context_value (Any, optional): Value to be made available to all resolvers via
|
||||||
`info.context`. Can be used to share authorization, dataloaders or other
|
`info.context`. Can be used to share authorization, dataloaders or other
|
||||||
information needed to resolve an operation.
|
information needed to resolve an operation.
|
||||||
variable_values (dict, optional): If variables are used in the request string, they can
|
variable_values (dict, optional): If variables are used in the request string, they can
|
||||||
|
|
|
@ -172,7 +172,7 @@ def test_enum_can_be_compared():
|
||||||
assert RGB.BLUE == 3
|
assert RGB.BLUE == 3
|
||||||
|
|
||||||
|
|
||||||
def test_enum_can_be_initialzied():
|
def test_enum_can_be_initialized():
|
||||||
class RGB(Enum):
|
class RGB(Enum):
|
||||||
RED = 1
|
RED = 1
|
||||||
GREEN = 2
|
GREEN = 2
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Union(UnmountedType, BaseType):
|
||||||
The schema in this example can take a search text and return any of the GraphQL object types
|
The schema in this example can take a search text and return any of the GraphQL object types
|
||||||
indicated: Human, Droid or Startship.
|
indicated: Human, Droid or Startship.
|
||||||
|
|
||||||
Ambigous return types can be resolved on each ObjectType through ``Meta.possible_types``
|
Ambiguous return types can be resolved on each ObjectType through ``Meta.possible_types``
|
||||||
attribute or ``is_type_of`` method. Or by implementing ``resolve_type`` class method on the
|
attribute or ``is_type_of`` method. Or by implementing ``resolve_type`` class method on the
|
||||||
Union.
|
Union.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from .scalars import Scalar
|
||||||
|
|
||||||
class UUID(Scalar):
|
class UUID(Scalar):
|
||||||
"""
|
"""
|
||||||
Leverages the internal Python implmeentation of UUID (uuid.UUID) to provide native UUID objects
|
Leverages the internal Python implementation of UUID (uuid.UUID) to provide native UUID objects
|
||||||
in fields, resolvers and input.
|
in fields, resolvers and input.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user