mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Improved options
This commit is contained in:
parent
2b676743ae
commit
31ea09ff30
|
@ -33,15 +33,14 @@ class GrapheneEnumType(GrapheneType, GraphQLEnumType):
|
|||
class EnumTypeMeta(ClassTypeMeta):
|
||||
|
||||
def get_options(cls, meta):
|
||||
options = cls.options_class(
|
||||
return cls.options_class(
|
||||
meta,
|
||||
name=None,
|
||||
description=None,
|
||||
enum=None,
|
||||
graphql_type=None,
|
||||
abstract=False
|
||||
)
|
||||
options.valid_attrs = ['graphql_type', 'name', 'description', 'enum', 'abstract']
|
||||
return options
|
||||
|
||||
def construct_graphql_type(cls, bases):
|
||||
if not cls._meta.graphql_type and not cls._meta.abstract:
|
||||
|
|
|
@ -13,14 +13,13 @@ class GrapheneInputObjectType(GrapheneFieldsType, GraphQLInputObjectType):
|
|||
class InputObjectTypeMeta(ClassTypeMeta):
|
||||
|
||||
def get_options(cls, meta):
|
||||
options = cls.options_class(
|
||||
return cls.options_class(
|
||||
meta,
|
||||
name=None,
|
||||
description=None,
|
||||
graphql_type=None,
|
||||
abstract=False
|
||||
)
|
||||
options.valid_attrs = ['graphql_type', 'name', 'description', 'abstract']
|
||||
return options
|
||||
|
||||
def construct_graphql_type(cls, bases):
|
||||
if not cls._meta.graphql_type and not cls._meta.abstract:
|
||||
|
|
|
@ -11,14 +11,13 @@ class GrapheneInterfaceType(GrapheneFieldsType, GraphQLInterfaceType):
|
|||
class InterfaceTypeMeta(ClassTypeMeta):
|
||||
|
||||
def get_options(cls, meta):
|
||||
options = cls.options_class(
|
||||
return cls.options_class(
|
||||
meta,
|
||||
name=None,
|
||||
description=None,
|
||||
graphql_type=None,
|
||||
abstract=False
|
||||
)
|
||||
options.valid_attrs = ['graphql_type', 'name', 'description', 'abstract']
|
||||
return options
|
||||
|
||||
def construct_graphql_type(cls, bases):
|
||||
if not cls._meta.graphql_type and not cls._meta.abstract:
|
||||
|
|
|
@ -41,15 +41,14 @@ class GrapheneObjectType(GrapheneFieldsType, GraphQLObjectType):
|
|||
class ObjectTypeMeta(ClassTypeMeta):
|
||||
|
||||
def get_options(cls, meta):
|
||||
options = cls.options_class(
|
||||
return cls.options_class(
|
||||
meta,
|
||||
name=None,
|
||||
description=None,
|
||||
graphql_type=None,
|
||||
interfaces=[],
|
||||
abstract=False
|
||||
)
|
||||
options.valid_attrs = ['graphql_type', 'name', 'description', 'interfaces', 'abstract']
|
||||
return options
|
||||
|
||||
def construct_graphql_type(cls, bases):
|
||||
if not cls._meta.graphql_type and not cls._meta.abstract:
|
||||
|
|
|
@ -6,7 +6,7 @@ class Options(object):
|
|||
self.parent = None
|
||||
for name, value in defaults.items():
|
||||
setattr(self, name, value)
|
||||
self.valid_attrs = []
|
||||
self.valid_attrs = defaults.keys()
|
||||
|
||||
def contribute_to_class(self, cls, name):
|
||||
cls._meta = self
|
||||
|
|
|
@ -50,14 +50,13 @@ class GrapheneScalarType(GrapheneType, GraphQLScalarType):
|
|||
class ScalarTypeMeta(ClassTypeMeta):
|
||||
|
||||
def get_options(cls, meta):
|
||||
options = cls.options_class(
|
||||
return cls.options_class(
|
||||
meta,
|
||||
name=None,
|
||||
description=None,
|
||||
graphql_type=None,
|
||||
abstract=False
|
||||
)
|
||||
options.valid_attrs = ['graphql_type', 'name', 'description', 'abstract']
|
||||
return options
|
||||
|
||||
def construct_graphql_type(cls, bases):
|
||||
if not cls._meta.graphql_type and not cls._meta.abstract:
|
||||
|
|
Loading…
Reference in New Issue
Block a user