Skip to content

Proposal: Add support for extends #31

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
4F2E4A2E opened this issue Feb 15, 2018 · 2 comments
Closed

Proposal: Add support for extends #31

4F2E4A2E opened this issue Feb 15, 2018 · 2 comments
Labels
Duplicate 🔑 This issue or pull request already exists

Comments

@4F2E4A2E
Copy link
Contributor

Please add support for object extension.

@GraphQLObjectType()
abstract class B {
    @Field()
    b: string;
}

@GraphQLObjectType()
abstract class A extends B {
    @Field()
    a: string;
}


@GraphQLResolver(() => TestResolver)
class TestResolver {

    @Query(returnType => A, {description: ''})
    test() {
        return {
            a: 'a-value',
            b: 'b-value'
        };
    }
}

Expected result:

{"data":{"test":{"a":"a-value","b":"b-value"}}}

Actual result:

{"errors":[{"message":"Cannot query field \"b\" on type \"A\". Did you mean \"a\"?","locations":[{"line":1,"column":9}]}]}
@MichalLytek
Copy link
Owner

MichalLytek commented Feb 15, 2018

It will be a part of #6 - I have to develop mechanism for looking up on other definitions for fields info.
Closing in favour of that issue 😉

@4F2E4A2E
Copy link
Contributor Author

I am happy to contribute 😉

@MichalLytek MichalLytek added the Duplicate 🔑 This issue or pull request already exists label Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🔑 This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants