How to use the tartiflette.types.argument.GraphQLArgument 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 / sdl / test_build_graphql_schema_from_sdl.py View on Github external
),
                    ),
                    (
                        "anotherField",
                        GraphQLField(
                            name="anotherField",
                            gql_type=GraphQLList(gql_type="Int"),
                        ),
                    ),
                    (
                        "fieldWithDefaultValueArg",
                        GraphQLField(
                            name="fieldWithDefaultValueArg",
                            gql_type="ID",
                            arguments=OrderedDict(
                                test=GraphQLArgument(
                                    name="test",
                                    gql_type="String",
                                    default_value="default",
                                )
                            ),
                        ),
                    ),
                    (
                        "simpleField",
                        GraphQLField(name="simpleField", gql_type="Date"),
                    ),
                ]
            ),
            interfaces=["Unknown", "Empty"],
        )
    )
github tartiflette / tartiflette / tests / unit / sdl / test_build_graphql_schema_from_sdl.py View on Github external
gql_type=GraphQLList(
                            gql_type=GraphQLList(
                                gql_type=GraphQLNonNull(gql_type="Date")
                            )
                        )
                    ),
                ),
            ),
        )
    )
    expected_schema.add_definition(
        GraphQLInputObjectType(
            name="UserInfo",
            fields=OrderedDict(
                [
                    ("name", GraphQLArgument(name="name", gql_type="String")),
                    (
                        "dateOfBirth",
                        GraphQLArgument(
                            name="dateOfBirth",
                            gql_type=GraphQLList(gql_type="Date"),
                        ),
                    ),
                    (
                        "graphQLFan",
                        GraphQLArgument(
                            name="graphQLFan",
                            gql_type=GraphQLNonNull(gql_type="Boolean"),
                        ),
                    ),
                ]
            ),
github tartiflette / tartiflette / tests / unit / types / test_argument.py View on Github external
assert arg == GraphQLArgument(
        name="Name",
        gql_type="Test",
        default_value=42,
        description="description",
    )
    # Currently we ignore the description in comparing
    assert arg == GraphQLArgument(
        name="Name", gql_type="Test", default_value=42
    )
    ## Different
    assert arg != GraphQLArgument(
        name="Name", gql_type="Test", default_value=24
    )
    assert arg != GraphQLArgument(name="Name", gql_type="Test")
    assert arg != GraphQLArgument(
        name="Name", gql_type="NotTest", default_value=42
    )
    assert arg != GraphQLArgument(
        name="OtherName", gql_type="Test", default_value=42
    )
github tartiflette / tartiflette / tests / unit / types / test_input_object.py View on Github external
def test_graphql_input_object_repr():
    input_object = GraphQLInputObjectType(
        name="Name",
        fields=OrderedDict(
            [
                ("test", GraphQLArgument(name="arg", gql_type="Int")),
                ("another", GraphQLArgument(name="arg", gql_type="String")),
            ]
        ),
        description="description",
    )

    assert (
        input_object.__repr__() == "GraphQLInputObjectType(name='Name', "
        "fields=OrderedDict(["
        "('test', GraphQLArgument(name='arg', gql_type='Int', default_value=None, description=None, directives=None)), "
        "('another', GraphQLArgument(name='arg', gql_type='String', default_value=None, description=None, directives=None))"
        "]), description='description')"
    )
    assert input_object == eval(repr(input_object))
github tartiflette / tartiflette / tests / unit / types / test_argument.py View on Github external
def test_graphql_argument_eq():
    arg = GraphQLArgument(
        name="Name",
        gql_type="Test",
        default_value=42,
        description="description",
    )

    ## Same
    assert arg == arg
    assert arg == GraphQLArgument(
        name="Name",
        gql_type="Test",
        default_value=42,
        description="description",
    )
    # Currently we ignore the description in comparing
    assert arg == GraphQLArgument(
github tartiflette / tartiflette / tests / unit / types / test_argument.py View on Github external
def test_graphql_argument_eq():
    arg = GraphQLArgument(
        name="Name",
        gql_type="Test",
        default_value=42,
        description="description",
    )

    ## Same
    assert arg == arg
    assert arg == GraphQLArgument(
        name="Name",
        gql_type="Test",
        default_value=42,
        description="description",
    )
    # Currently we ignore the description in comparing
    assert arg == GraphQLArgument(
        name="Name", gql_type="Test", default_value=42
    )
    ## Different
    assert arg != GraphQLArgument(
        name="Name", gql_type="Test", default_value=24
    )
    assert arg != GraphQLArgument(name="Name", gql_type="Test")
    assert arg != GraphQLArgument(
        name="Name", gql_type="NotTest", default_value=42
github tartiflette / tartiflette / tartiflette / schema / transformer.py View on Github external
if not input_value_definition_node:
        return None

    init_kwargs = {
        "name": parse_name(input_value_definition_node.name, schema),
        "description": parse_name(
            input_value_definition_node.description, schema
        ),
        "gql_type": parse_type(input_value_definition_node.type, schema),
        "default_value": input_value_definition_node.default_value,
        "directives": input_value_definition_node.directives,
    }

    if not as_argument_definition:
        return GraphQLInputField(**init_kwargs)
    return GraphQLArgument(
        **init_kwargs, definition=input_value_definition_node
    )