mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-22 06:30:52 +03:00
Updated v3 release notes (markdown)
parent
fb64c1941e
commit
61ab8ab854
|
@ -61,22 +61,21 @@ assert result.data["color"] == "RED"
|
||||||
|
|
||||||
⚠️ This is a breaking change. You will need to update any resolvers or mutations that accept enums as inputs to support this change. ⚠️
|
⚠️ This is a breaking change. You will need to update any resolvers or mutations that accept enums as inputs to support this change. ⚠️
|
||||||
|
|
||||||
Ref: https://github.com/graphql-python/graphene/pull/1153
|
Reference: https://github.com/graphql-python/graphene/pull/1153
|
||||||
|
|
||||||
### Fast ObjectType creation
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Base64 scalar
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Subscription support
|
### Subscription support
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
|
### Fast ObjectType creation
|
||||||
|
|
||||||
|
In Graphene v3 optimises the ObjectType initialization resulting in a x3 speed up! It does this by leveraging the same strategy that dataclasses introduced (dynamic creation of optimal `__init__` functions based on eval).
|
||||||
|
|
||||||
|
More info here: https://github.com/graphql-python/graphene/pull/1157
|
||||||
|
|
||||||
### Other new features
|
### Other new features
|
||||||
|
|
||||||
|
* Add a new Base64 scalar type (https://github.com/graphql-python/graphene/pull/1221)
|
||||||
* Better error messages when relay `global_id` fails to parse (https://github.com/graphql-python/graphene/pull/1074)
|
* Better error messages when relay `global_id` fails to parse (https://github.com/graphql-python/graphene/pull/1074)
|
||||||
* Graphene now accepts plain GraphQL types as well as Graphene types (https://github.com/graphql-python/graphene/pull/1224)
|
* Graphene now accepts plain GraphQL types as well as Graphene types (https://github.com/graphql-python/graphene/pull/1224)
|
||||||
|
|
||||||
|
@ -123,6 +122,42 @@ result = schema.execute("query { color(colorInput: RED) }")
|
||||||
assert result.data["color"] == "EnumMeta.RED"
|
assert result.data["color"] == "EnumMeta.RED"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ObjectType private fields
|
||||||
|
|
||||||
|
Previously you ObjectType's could be initialized with private variables by prepending the variable name with an `_`. This is no longer possible in v3 without defining a custom `__init__` function on the `ObjectType`.
|
||||||
|
|
||||||
|
Before:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from graphene import ObjectType, String
|
||||||
|
|
||||||
|
class User(ObjectType):
|
||||||
|
_private_state = None
|
||||||
|
|
||||||
|
name = String()
|
||||||
|
|
||||||
|
user = User(name="Leia", _private_state="Extra info")
|
||||||
|
assert user._private_state == "Extra info"
|
||||||
|
```
|
||||||
|
|
||||||
|
After:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from graphene import ObjectType, String
|
||||||
|
|
||||||
|
class User(ObjectType):
|
||||||
|
def __init__(self, _private_state=None, **kwargs):
|
||||||
|
self._private_state = _private_state
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
_private_state = None
|
||||||
|
|
||||||
|
name = String()
|
||||||
|
|
||||||
|
user = User(name="Leia", _private_state="Extra info")
|
||||||
|
assert user._private_state == "Extra info"
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
A huge thanks to everyone involved in bringing this release together!
|
A huge thanks to everyone involved in bringing this release together!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user