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

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

Open
bbqsrc opened this issue Mar 17, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@bbqsrc
Copy link

bbqsrc commented Mar 17, 2024

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
@bbqsrc bbqsrc added the bug Something isn't working label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant