# Buggy code
def input_value_definition(self, tree: Tree) -> GraphQLArgument:
    # TODO: Add directives
    description = None
    name = None
    gql_type = None
    default_value = None
    for child in tree.children:
        if child.type == "description":
            description = child.value
        elif child.type == "IDENT":
            name = child.value
        elif child.type == "type":
            gql_type = child.value
        elif child.type == "value":
            default_value = child.value
        elif child.type == "discard":
            pass
        else:
            raise UnexpectedASTNode(
                "Unexpected AST node `{}`, type `{}`".format(
                    child, child.__class__.__name__
                )
            )
    return GraphQLArgument(
        name=name,
        gql_type=gql_type,
        default_value=default_value,
        description=description,
    )


# Traceback (tartiflette.types.exceptions.tartiflette.UnexpectedASTNode)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/src/app/***/__main__.py", line 10, in <module>
sys.exit(run())
File "/usr/src/app/***/app.py", line 425, in run
"utils/sdl-generator/schema.sdl",
File "/usr/src/app/***/engines/tartiflette.py", line 70, in __init__
error_coercer=_error_coercer,
File "/usr/local/lib/python3.7/site-packages/tartiflette/engine.py", line 26, in __init__
schema_name, custom_default_resolver, exclude_builtins_scalars
File "/usr/local/lib/python3.7/site-packages/tartiflette/schema/bakery.py", line 41, in bake
schema = SchemaBakery._preheat(schema_name, exclude_builtins_scalars)
File "/usr/local/lib/python3.7/site-packages/tartiflette/schema/bakery.py", line 21, in _preheat
build_graphql_schema_from_sdl(sdl, schema=schema)
File "/usr/local/lib/python3.7/site-packages/tartiflette/sdl/builder.py", line 30, in build_graphql_schema_from_sdl
sdl, parse_graphql_sdl_to_ast(sdl), schema=schema
File "/usr/local/lib/python3.7/site-packages/tartiflette/sdl/builder.py", line 76, in transform_ast_to_schema
transformer.transform(raw_ast)
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 93, in transform
tree = t.transform(tree)
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 107, in transform
subtree.children = list(self._transform_children(subtree.children))
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 44, in _transform_children
yield self._transform_tree(c) if isinstance(c, Tree) else c
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 103, in _transform_tree
return self._call_userfunc(tree)
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 37, in _call_userfunc
return f(tree)
File "/usr/local/lib/python3.7/site-packages/lark/visitors.py", line 232, in f
return _f(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/tartiflette/sdl/transformers/schema_transformer.py", line 389, in input_value_definition
child, child.__class__.__name__
tartiflette.types.exceptions.tartiflette.UnexpectedASTNode: Unexpected AST node `SchemaNode(type='directives', value={'maxLength': {'limit': 512}})`, type `SchemaNode`

# Fixed code
def input_value_definition(self, tree: Tree) -> GraphQLArgument:
    # TODO: Add directives
    description = None
    name = None
    gql_type = None
    default_value = None
    directives = None
    for child in tree.children:
        if child.type == "description":
            description = child.value
        elif child.type == "IDENT":
            name = child.value
        elif child.type == "type":
            gql_type = child.value
        elif child.type == "value":
            default_value = child.value
        elif child.type == "discard":
            pass
        elif child.type == "directives":
            directives = child.value
        else:
            raise UnexpectedASTNode(
                "Unexpected AST node `{}`, type `{}`".format(
                    child, child.__class__.__name__
                )
            )
    return GraphQLArgument(
        name=name,
        gql_type=gql_type,
        default_value=default_value,
        description=description,
        directives=directives,
    )