Skip to content

Support rename argument sdl name in async_graphql::Interface derive macro. #1356

@al8n

Description

@al8n

Description of the feature

When using async_graphql::Interface, there seems to be no way to define the arg name in sdl schema.

In the below example, I have an argument called where, but where is a keyword in Rust, I have to change it to another name, but I still want my users use where when querying.
e.g.

#[derive(Interface)]
#[graphql(
    field(name = "value_c", ty = "i32",
        arg(name = "where", ty = "i32")
    )
)]
enum MyInterface {
    TypeA(TypeA)
}

I would like to suggest having the below functionality.

#[derive(Interface)]
#[graphql(
    field(name = "value_c", ty = "i32",
        arg(name = "filter", graphql(name = "where"), ty = "i32")
    )
)]
enum MyInterface {
    TypeA(TypeA)
}

or

#[derive(Interface)]
#[graphql(
    field(name = "value_c", ty = "i32",
        arg(name = "filter", graphql_name = "where", ty = "i32")
    )
)]
enum MyInterface {
    TypeA(TypeA)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions