Closed
Description
This is quite an obscure bug that I doubt many will run into, but I did hit while building juniper-from-schema.
Describe the bug
If you define an object like this:
#[graphql_object]
impl Query {
#[graphql(
arguments(
a(description = "foo"),
b(description = "bar"),
)
)]
fn add(a: i32, b: i32) -> i32 {
a + b
}
}
Then the docs on the arguments show up just fine in GraphiQL.
However if you use raw identifiers
#[graphql_object]
impl Query {
#[graphql(
arguments(
r#a(description = "foo"),
r#b(description = "bar"),
)
)]
fn add(r#a: i32, r#b: i32) -> i32 {
a + b
}
}
Then they don't show up
To Reproduce
Example warp app with GraphiQL that I used for debugging this
use juniper::*;
use warp::Filter;
type Schema = RootNode<'static, Query, EmptyMutation<()>, EmptySubscription<()>>;
fn schema() -> Schema {
Schema::new(
Query,
EmptyMutation::<()>::new(),
EmptySubscription::<()>::new(),
)
}
struct Query;
#[graphql_object]
impl Query {
#[graphql(
arguments(
r#a(description = "foo"),
r#b(description = "bar"),
)
)]
fn add(r#a: i32, r#b: i32) -> i32 {
a + b
}
}
#[tokio::main]
async fn main() {
let state = warp::any().map(move || ());
let graphql_filter = juniper_warp::make_graphql_filter(schema(), state.boxed());
let graphiql_filter = warp::get()
.and(warp::path("graphiql"))
.and(juniper_warp::graphiql_filter("/graphql", None));
warp::serve(graphiql_filter.or(warp::path("graphql").and(graphql_filter)))
.run(([127, 0, 0, 1], 8080))
.await
}