mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-19 21:10:37 +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. ⚠️
|
||||
|
||||
Ref: https://github.com/graphql-python/graphene/pull/1153
|
||||
|
||||
### Fast ObjectType creation
|
||||
|
||||
TODO
|
||||
|
||||
### Base64 scalar
|
||||
|
||||
TODO
|
||||
Reference: https://github.com/graphql-python/graphene/pull/1153
|
||||
|
||||
### Subscription support
|
||||
|
||||
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
|
||||
|
||||
* 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)
|
||||
* 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"
|
||||
```
|
||||
|
||||
### 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!
|
||||
|
|
Loading…
Reference in New Issue
Block a user