How to use the tartiflette.language.parsers.lark.transformers.node_transformer.SchemaNode function in tartiflette

To help you get started, we’ve selected a few tartiflette examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tartiflette / tartiflette / tests / unit / language / parsers / lark / transformers / test_converters.py View on Github external
def test_extract_node_info_unexpected_ast_node():
    with pytest.raises(UnexpectedASTNode):
        _extract_node_info([SchemaNode(type="unexpected", value=None)])
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def enum_value_definition(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type
        "enum_value_definition" with an EnumValueDefinitionNode instance as
        value (extracted from the parsing of the tree instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "enum_value_definition" with an
        EnumValueDefinitionNode instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(
            type="enum_value_definition",
            value=lark_to_enum_value_definition_node(tree),
        )
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def value(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "value" with a
        ValueNode instance as value (extracted from the parsing of the tree
        instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "value" with a ValueNode
        instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(type="value", value=tree.children[0].value)
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def argument(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "argument" with a
        ArgumentNode instance as value (extracted from the parsing of the tree
        instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "argument" with an ArgumentNode
        instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(type="argument", value=lark_to_argument_node(tree))
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def operation_type_definition(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type
        "operation_type_definition" with an OperationTypeDefinitionNode
        instance as value (extracted from the parsing of the tree instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "operation_type_definition" with
        an OperationTypeDefinitionNode instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(
            type="operation_type_definition",
            value=lark_to_operation_type_definition_node(tree),
        )
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def directive_locations(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "directive_locations"
        with a list of NameNode instance as value (extracted from the parsing
        of the tree instance).
        :param tree: the Tree to parse in order to extract the proper node
        :return: a SchemaNode instance of type "directive_locations" with a
        list of NameNode instance as value
        """
        # pylint: disable=no-self-use
        return SchemaNode(
            type="directive_locations",
            value=[child.value for child in tree.children],
        )
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def directive_location(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "directive_location"
        with a NameNode instance as value (extracted from the parsing of the
        tree instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "directive_location" with a
        NameNode instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(
            type="directive_location", value=lark_to_name_node(tree)
        )
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def directive(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "directive" with a
        DirectiveNode instance as value (extracted from the parsing of the tree
        instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "directive" with a DirectiveNode
        instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(type="directive", value=lark_to_directive_node(tree))
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def type(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type "type" with a
        TypeNode instance as value (extracted from the parsing of the tree
        instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "type" with a TypeNode instance
        as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(type="type", value=tree.children[0].value)
github tartiflette / tartiflette / tartiflette / language / parsers / lark / transformers / node_transformer.py View on Github external
def directive_definition(self, tree: "Tree") -> "SchemaNode":
        """
        Creates and returns a SchemaNode instance of type
        "directive_definition" with a DirectiveDefinitionNode instance as value
        (extracted from the parsing of the tree instance).
        :param tree: the Tree to parse in order to extract the proper node
        :type tree: Tree
        :return: a SchemaNode instance of type "directive_definition" with a
        DirectiveDefinitionNode instance as value
        :rtype: SchemaNode
        """
        # pylint: disable=no-self-use
        return SchemaNode(
            type="directive_definition",
            value=lark_to_directive_definition_node(tree),
        )