Skip to content

Using flatten inside an impl with no other fields causes a compile error #1494

Open
@bbqsrc

Description

@bbqsrc

Expected Behavior

Using flatten on a struct without any other fields should work, as it used to. This is a regression. And yes I know that this pattern is strange but I have good reasons to be using it, haha.

Actual Behavior

It gives an error now:

error: A GraphQL Object type must define one or more fields.

Steps to Reproduce the Problem

#[derive(Debug, SimpleObject)]
pub struct Inner {
    pub foo: String
}

pub struct Foo;

#[Object]
impl Foo {
    #[graphql(flatten)]
    async fn _inner(&self) -> Inner {
        Inner {
            foo: "bar".to_string()
        }
    }
}

Specifications

  • Version: 7.0.2
  • Platform: macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions