Skip to content

Using Union and OneofObject on the same struct #1116

@ClementNerma

Description

@ClementNerma

Hi!

I found out that you can't use both Union and OneofObject derives on the same struct. Is there something I'm missing (like some kind of additional attribute or impl) or is that plainly impossible right now?

It'd be immensely useful for this to work, just like you can put both SimpleObject and InputObject on the same struct.

Thanks in advance for your help!

EDIT: Here are the error messages I'm getting

thread 'main' panicked at 'Register `AppVolumeTypeGraphQL` as `InputObject`, but it is already registered as `Union`', /home/clement/.cargo/registry/src/github.com-1ecc6299db9ec823/async-graphql-4.0.15/src/registry/mod.rs:673:25

And if I add a #[graphql(input_name = "xxx")] after the derive attributes:

Unknown field: `input_name`
[...]
= note: this error originates in the macro `graphql_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions