mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +03:00
Added required option in Argument
This commit is contained in:
parent
2696ae9b73
commit
4f52498a06
|
@ -2,12 +2,17 @@ from collections import OrderedDict
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
from ..utils.orderedtype import OrderedType
|
from ..utils.orderedtype import OrderedType
|
||||||
|
from .structures import NonNull
|
||||||
|
|
||||||
|
|
||||||
class Argument(OrderedType):
|
class Argument(OrderedType):
|
||||||
|
|
||||||
def __init__(self, type, default_value=None, description=None, name=None, _creation_counter=None):
|
def __init__(self, type, default_value=None, description=None, name=None, required=False, _creation_counter=None):
|
||||||
super(Argument, self).__init__(_creation_counter=_creation_counter)
|
super(Argument, self).__init__(_creation_counter=_creation_counter)
|
||||||
|
|
||||||
|
if required:
|
||||||
|
type = NonNull(type)
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = type
|
self.type = type
|
||||||
self.default_value = default_value
|
self.default_value = default_value
|
||||||
|
|
Loading…
Reference in New Issue
Block a user