Juniper: Could not find `object` in juniper.

Created on 24 May 2020  Â·  5Comments  Â·  Source: graphql-rust/juniper

Describe the bug
The documentation states that the graphql_object macro is deprecated and the object proc macro should be used instead. The object macro is not exported from juniper.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to use juniper::object on an impl for a struct.

Expected behavior
The procedural macro to run and produce an output.

Additional context
Because the object macro exists in juniper_codegen I think this is just a case of exporting it from juniper. I'd be happy to submit a PR doing this.

bug docs

Most helpful comment

That’s good to know! I was just a bit confused because there is an object proc macro in juniper_codegen crate.
I’ll submit a PR.
https://docs.rs/juniper_codegen/0.14.2/juniper_codegen/attr.object.html

On 24 May 2020, at 17:32, Christian Legnitto notifications@github.com wrote:

Hello! The doc is actually wrong, the name of the proc macro is graphql_object. Would love a PR to fix.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/graphql-rust/juniper/issues/668#issuecomment-633256490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSTPMZBXL2JINU3TG7FKLRTFDYRANCNFSM4NIZ7VYQ.

All 5 comments

Hello! The doc is actually wrong, the name of the proc macro is graphql_object. Would love a PR to fix.

That’s good to know! I was just a bit confused because there is an object proc macro in juniper_codegen crate.
I’ll submit a PR.
https://docs.rs/juniper_codegen/0.14.2/juniper_codegen/attr.object.html

On 24 May 2020, at 17:32, Christian Legnitto notifications@github.com wrote:

Hello! The doc is actually wrong, the name of the proc macro is graphql_object. Would love a PR to fix.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/graphql-rust/juniper/issues/668#issuecomment-633256490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFSTPMZBXL2JINU3TG7FKLRTFDYRANCNFSM4NIZ7VYQ.

I am a little confused what to use now ...
for me [juniper:object] shows up, if try graphql_object it doesn't find it in scope.
I also can't use await in my query, it complains with await is only allowed inside async, but my resolver is declared as async as you can see. Am I missing something? Last one might be a different issue but I am not even sure if I use right macro now.
In cargo I have:
juniper = "0.14.2"

```

[juniper::object(

Context = Context,

)]
impl QueryRoot {
fn api_version() -> &'static str {
"0.1"
}

async fn skills(context: &Context, id: String) -> FieldResult<Vec<Skill>> {
    let skills = storage::skills::read().await;
    return Ok(skills);
}

}

On the latest crates.io release async is not supported...you need to use master (and juniper:: graphql_object). Hope that helps!

Thanks that helped indeed! So easy!

On Tue, 9 Jun 2020 at 18:49, Christian Legnitto notifications@github.com
wrote:

On the latest crates.io release async is not supported...you need to use
master (and juniper:: graphql_object). Hope that helps!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/graphql-rust/juniper/issues/668#issuecomment-641393362,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABABKW5K2FCKLDGDBTNEHOLRVZKZ3ANCNFSM4NIZ7VYQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

takeit picture takeit  Â·  5Comments

norcalli picture norcalli  Â·  6Comments

davidpdrsn picture davidpdrsn  Â·  5Comments

tomhoule picture tomhoule  Â·  4Comments

acelot picture acelot  Â·  3Comments