Skip to content

#[juniper::object] interfaces attribute not documented #658

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

Closed
jacobh opened this issue May 11, 2020 · 1 comment
Closed

#[juniper::object] interfaces attribute not documented #658

jacobh opened this issue May 11, 2020 · 1 comment
Assignees
Labels
k::documentation Related to project documentation

Comments

@jacobh
Copy link
Contributor

jacobh commented May 11, 2020

Hi,

this afternoon I've been porting some graphql types to using the attribute macro syntax. I was stuck trying to get my interfaces working correctly.

I think I've figured it out, with interfaces now being an attribute of the macro, but I couldn't see any mention of that syntax anywhere in the docs, and had to dig into the source.

Other than this I'm very much liking the attribute macro syntax! reads much more nicely, and rustfmt works correctly.

Old:

graphql_object!(DynamicQueueContext: Context as "DynamicQueue" |&self| {
    interfaces: [Box<dyn QueueContext>]

    // Queue interface fields
    field id() -> Uuid {
        ContextItem::id(self)
    }
    field name() -> String {
        self.name()
    }
    ...
}

New:

#[juniper::object(
    name = "DynamicQueue"
    Context = Context
    interfaces = [Box<dyn QueueContext>]
)]
impl DynamicQueueContext {
    // Queue interface fields
    fn id(&self) -> Uuid {
        ContextItem::id(self)
    }
    fn name(&self) -> String {
        self.name()
    }
    ...
}
@jacobh jacobh added bug Something isn't working needs-triage labels May 11, 2020
@LegNeato LegNeato added k::documentation Related to project documentation good-first-issue help wanted and removed bug Something isn't working needs-triage labels May 14, 2020
@tyranron tyranron self-assigned this Jun 30, 2020
@tyranron tyranron closed this as completed Oct 6, 2020
@tyranron
Copy link
Member

tyranron commented Oct 6, 2020

Now documented in Book along with interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k::documentation Related to project documentation
Projects
None yet
Development

No branches or pull requests

3 participants