smooth-code / graphql-directive

Use custom directives in your GraphQL schema and queries 🎩
MIT License
152 stars 14 forks source link

Support latest graphql version? #2

Closed adampash closed 6 years ago

adampash commented 6 years ago

I've noticed some issues if I'm using this with the latest graphql (0.12.3). If I try using it on a schema, the first error I get is:

Uncaught TypeError: Cannot read property 'FIELD_DEFINITION' of undefined

Which is coming from here. It seems that the latest graphql has updated some of the object mappings. (Seems like there are a lot of updates to the schema in 0.12.)

gregberge commented 6 years ago

Thanks for reporting it! Looks like they are moving forward in this direction, they now exposed some internal functions. I made a PR but I would like to support v0.11 and v0.12, would do it soon. Feel free to point on my PR if you want to use it before releasing.

adampash commented 6 years ago

Oh yeah, I just realized graphql-tools has added an attachDirectiveResolvers. I'll probably just use that for now, then, for the newer graphql package. Thanks for this, though!

gregberge commented 6 years ago

@adampash yes you can use it but it will not support directives in queries.

gregberge commented 6 years ago

version 0.2.0 supports graphql@^0.11 and graphql@^0.12.