Bot releases are visible (Hide)
This release brings two new features and several fixes and semantic upgrades due to new Python features. Thanks to everyone that contributed! 😊
⚠️⚠️ACTION REQUIRED⚠️⚠️
In GraphQL, inputs can have fields which are optional. Currently, if those fields are not specified in the query, they are passed to the python inputs as None
. This renders them indistinguishable from fields that are actually passed to the query with a value of null
. While the alternative would be to check the definition via "key" in input
, it is more accessible to mark these fields as explicitly UNDEFINED
.
This PR adds a new global override, which allows unspecified fields to be set to graphql.UNDEFINED
. In the future, the default Value will be set to UNDEFINED
, making this a soft migration and deprecation of the previous situation.
This is a soft migration. Long-Term, the Input Objects will ALWAYS contain the value UNDEFINED
Make sure your code supports these cases in None
checks. After the default has been set to UNDEFINED
, you will still be able to switch back to None
for the foreseeable future.
Custom Relay connection classes can now be made NonNull
using the strict_types
option on the connection meta.
Using this example
class MyObjectConnection(Connection):
class Meta:
node = MyObject
strict_types = True
will change from
type MyObjectConnection {
edges: [MyObject]
}
to
type MyObjectConnection {
edges: [MyObject!]!
}
We want to make sure you're informed about using NonNull relay connections. While they are a great way to get rid of some null checks in typed frontends, it's important to be mindful of error handling with these connections. When working with NonNull connections, it's crucial to remember that if a requested field or edge is not available or the resolver throws an error, the error will bubble up to the next nullable parent field, which is oftentimes the root node. That way, you cannot handle partial results in case of partial errors anymore. In a nullable connection, only the nullable fields will be set to null and the error will not bubble up.
To address this, we recommend considering waiting for the future release of client-controlled nullability for cases where certain connections might be nullable. By opting for client-controlled nullability, you gain more control over error handling, enabling you to handle potential null values more gracefully and enhance the overall user experience. Read more about client controlled nullability here: https://github.com/graphql/graphql-spec/issues/867
typing.TYPE_CHECKING
instead of MYPY by @rapsealk in https://github.com/graphql-python/graphene/pull/1503
Full Changelog: https://github.com/graphql-python/graphene/compare/v3.2.2...v3.3.0
Published by erikwrede over 1 year ago
This release provides some internal refactoring to the relay types to improve support for adding custom fields to them.
Published by erikwrede almost 2 years ago
Non-required InputFields
and Arguments
can now be marked as deprecated by passing the deprecation_reason
keyword argument to the constructor.
Full Changelog: https://github.com/graphql-python/graphene/compare/v3.2.0...v3.2.1
Published by erikwrede almost 2 years ago
relay.Node
The global ID type of a Node
can now be customized:
class CustomNode(Node):
class Meta:
global_id_type = CustomGlobalIDType
class User(ObjectType):
class Meta:
interfaces = [CustomNode]
name = String()
@classmethod
def get_node(cls, _type, _id):
return self.users[_id]
Currently, the following types are available:
DefaultGlobalIDType
: Default global ID type: base64 encoded version of ": ". (Previously the only option) Scalar: ID
SimpleGlobalIDType
: Simple global ID type: simply the id of the object. Scalar: ID
UUIDGlobalIDType
: UUID global ID type. Scalar: UUID
To create a custom global type, BaseGlobalIDType
must be extended:
class CustomGlobalIDType(BaseGlobalIDType):
graphene_type = CustomScalar
@classmethod
def resolve_global_id(cls, info, global_id):
_type = custom_get_type_from_global_id(global_id)
return _type, global_id
@classmethod
def to_global_id(cls, _type, _id):
return _id
graphene_type
specifies the type of scalar to be used in the schema. Remember, that if you're using ID
as a scalar, you might need to deserialize your custom global ID first!
Relevant PR:
ObjectTypes
can be copied again #1333 by @keu210description
: #1478 by @mike-roberts-healxFull Changelog: https://github.com/graphql-python/graphene/compare/v3.1.1...v3.2.0
Published by erikwrede about 2 years ago
Graphene now includes an updated version of aiodataloader
by Syrus Akbary under graphene.utils.dataloader
due to inactivity of the old repository. The update fixes an issue some users experienced when trying to use dataloader
in conjunction with pytest (https://github.com/syrusakbary/aiodataloader/issues/13). Further contributions and updates to dataloader in this repo are welcome!
A custom typename can now be added when using from_enum
:
from enum import Enum as PyEnum
class Color(PyEnum):
RED = 1
YELLOW = 2
BLUE = 3
GColor = Enum.from_enum(Color, description="original colors")
UniqueGColor = Enum.from_enum(
Color, name="UniqueColor", description="unique colors"
)
type Query {
color: Color!
uniqueColor: UniqueColor!
}
"""original colors"""
enum Color {
RED
YELLOW
BLUE
}
"""unique colors"""
enum UniqueColor {
RED
YELLOW
BLUE
}
Interfaces extending interfaces is now supported!
class FooInterface(Interface):
foo = String()
class BarInterface(Interface):
class Meta:
interfaces = [FooInterface]
foo = String()
bar = String()
interface FooInterface {
foo: String
}
interface BarInterface implements FooInterface {
foo: String
bar: String
}
Thank you to everyone that contributed to this release!
DataLoader
from aiodataloader
and move get_event_loop()
out of __init__
function. by @flipbit03 in https://github.com/graphql-python/graphene/pull/1459
Full Changelog: https://github.com/graphql-python/graphene/compare/v3.1.0...v3.1.1
Published by jkimbo over 2 years ago
Full Changelog: https://github.com/graphql-python/graphene/compare/v3.0.0...v3.1.0
Published by mvanlonden almost 3 years ago
The full release notes including an upgrade guide can be found here: https://github.com/graphql-python/graphene/wiki/v3-release-notes
args
by @jkimbo in https://github.com/graphql-python/graphene/pull/1170
default_value
regardless if the input field is required by @minhtule in https://github.com/graphql-python/graphene/pull/1326
Full Changelog: https://github.com/graphql-python/graphene/compare/v2.1.8...v3.0.0
Published by ekampf about 3 years ago
graphql-core
dependency resolution. (#1377)All changes: https://github.com/graphql-python/graphene-django/compare/v3.0.0b7...v3.0.0b8
Published by jkimbo over 3 years ago
Published by jkimbo almost 4 years ago
All changes: https://github.com/graphql-python/graphene-django/compare/v3.0.0b6...v3.0.0b7
Published by jkimbo almost 4 years ago
All changes: https://github.com/graphql-python/graphene-django/compare/v3.0.0b5...v3.0.0b6
Published by jkimbo about 4 years ago
Full changelog: https://github.com/graphql-python/graphene-django/compare/v3.0.0b4...v3.0.0b5
Published by jkimbo over 4 years ago
Full changelog: https://github.com/graphql-python/graphene-django/compare/v3.0.0b3...v3.0.0b4
Published by jkimbo over 4 years ago
Full changelog: https://github.com/graphql-python/graphene-django/compare/v3.0.0b2...v3.0.0b3
Published by jkimbo over 4 years ago
Third beta release for Graphene v3.
Changes: https://github.com/graphql-python/graphene/compare/v3.0.0b1...v3.0.0b2
Published by jkimbo over 4 years ago
Second beta release for Graphene v3.
Changes: https://github.com/graphql-python/graphene/compare/v3.0.0b0...v3.0.0b1
source
attribute now uses the default resolver function #1155Published by Cito over 4 years ago
First beta release of Graphene based on GraphQL-Core v3.1
Published by mvanlonden about 5 years ago
First Graphene alpha release compatible with GraphQL-Core v3.0 (graphql-core-next)
Published by mvanlonden about 5 years ago