Closed kymmt90 closed 6 years ago
@exAspArk How about this PR?
@exAspArk - So is this repository abandoned?
Hey, sorry for the delay. I'll have time to review the changes tomorrow
Seems like the changes break compatibility with previous GraphQL Ruby versions (GraphQL::Schema::Object.accepts_definition
). Going to check whether it's possible to keep the version compatible or not.
Hey @kymmt90!
I merged your PR. I added some more changes in https://github.com/exAspArk/graphql-guard/pull/17 to keep graphql-guard
compatible with older graphql-ruby
versions. I also added a build matrix in travis.yml to build tests with graphql-ruby
version 1.7 and 1.8 at the same time.
Thanks a lot for the PR! Great job! 🙌
@exAspArk
Thank you for your review! 😄
Partially fixes the problem discussed in #15
This PR allows inline guard policies to be used with class-based API of graphql-ruby 1.8.
In class-based API of graphql-ruby 1.8,
GraphQL::Schema::Object
andGraphQL::Schema::Field
are used as base classes for class-based schema. In order to use class-based API with graphql-guard and to keep interface compatibility, these classes need to accept metadataguard
andmask
.accepts_definition
is available for these cases.http://graphql-ruby.org/api-doc/1.8.2/GraphQL/Schema/Member/AcceptsDefinition
Also in order to keep
GraphQL::Guard::Testing
compatibility,GraphQL::Schema::Object
needs to have the class method.field_with_guard
where these methods are utilized:fields
to_graphql
GraphQL::Schema::Object
to corresponding legacy-style object likeGraphQL::ObjectType
When class-based API is used, the testing method
GraphQL::Field#guard
uses objects converted byto_graphql
.These changes are tested by graphql-ruby 1.8.2.