Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
al8n opened this issue Aug 24, 2023 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@al8n
Copy link
Contributor

al8n commented Aug 24, 2023

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)
}
@al8n al8n added the enhancement New feature or request label Aug 24, 2023
@sunli829
Copy link
Collaborator

You don't need to rename now and don't use name to generate the identifier. 🙂

@sunli829
Copy link
Collaborator

released in v6.0.7

tusharmath pushed a commit to tailcallhq/async-graphql that referenced this issue Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants