Skip to content

Conversation

dschafer
Copy link
Contributor

@dschafer dschafer commented Aug 6, 2015

Ensures that if a type isn't referenced directly, but implements an interface that is references, that type is included in the schema, with a unit test to verify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is O(N^2) since you need to filter down the AST and produceTypeDef for the implementing types for every interface you encounter, (so really O(I*N))

Here's how I did it in https://github.com/graphql/graphql-js/blob/master/src/utilities/buildClientSchema.js#L302

On a side note, you may consider comparing this file to that file to see if there are any other gaps

@dschafer
Copy link
Contributor Author

dschafer commented Aug 6, 2015

Good call. Changed it to iterate through all types; now the produceTypeMap for the query will just hit cache (where before, it was actually constructing the types).

@leebyron
Copy link
Contributor

leebyron commented Aug 6, 2015

wonderful. I love that it ended up being a one-liner and the bulk of this is tests :) land it

dschafer added a commit that referenced this pull request Aug 6, 2015
Ensure unreferenced types that implement reference interfaces are detected
@dschafer dschafer merged commit e99fc53 into master Aug 6, 2015
@dschafer dschafer deleted the fixinterface branch August 6, 2015 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants