mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-12 17:12:21 +03:00
Make scalar get_type an instance method.
Given the current way of how Scalars are mostly being created in the schema, e.g. `graphene.Boolean(description='Some boolean')` and then how they get 'magically' turned into a `Field` using `self.get_type()` it makes sense to make this an Instance method rather than a classmethod. This allows e.g. to set attributes on the instance that will always be accessible, as they are being returned by `get_type`.
This commit is contained in:
parent
0a80119f5e
commit
d3305f6056
|
@ -41,9 +41,8 @@ class Scalar(six.with_metaclass(ScalarTypeMeta, UnmountedType)):
|
||||||
parse_value = None
|
parse_value = None
|
||||||
parse_literal = None
|
parse_literal = None
|
||||||
|
|
||||||
@classmethod
|
def get_type(self):
|
||||||
def get_type(cls):
|
return self
|
||||||
return cls
|
|
||||||
|
|
||||||
# As per the GraphQL Spec, Integers are only treated as valid when a valid
|
# As per the GraphQL Spec, Integers are only treated as valid when a valid
|
||||||
# 32-bit signed integer, providing the broadest support across platforms.
|
# 32-bit signed integer, providing the broadest support across platforms.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user