Skip to content

No __typename included for interface fields without "onImplementation()" #919

@martinvisser

Description

@martinvisser

In our graph we have multiple interfaces and implementations. If someone constructs a query as follows __typename is of course added during serialization:

        var query = new ProfileProjectionRoot<>();
        var account = query.account();
        account.customer().__typename().id();
        query.agreements().__typename().number();

Both customer and agreements are interfaces.

When using this, __typename is also included:

        var query = new ProfileProjectionRoot<>();
        var account = query.account();
        account.customer().onSomeCustomerImplementation().id();
        query.agreements().onAgreementImplementation().number();

But, when using fields that are defined on the interface itself, __typename is not automatically included:

        var query = new ProfileProjectionRoot<>();
        var account = query.account();
        account.customer().id();
        query.agreements().number();

Is this expected behaviour of the serialization step, or might there be a way to automatically include __typename is an interface field is queried?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions