【文件属性】:
文件名称:graphql-guard:GraphQL的简单授权gem
文件大小:18KB
文件格式:ZIP
更新时间:2021-02-02 04:30:55
ruby graphql gem guard authorization
图形保护器
此gem为提供了字段级授权。
内容
用法
定义一个GraphQL模式:
# Define a type
class PostType < GraphQL :: Schema :: Object
field :id , ID , null : false
field :title , String , null : true
end
# Define a query
class QueryType < GraphQL :: Schema :: Object
field :posts , [ PostType ] , null : false do
argument :user_id , ID , required : true
end
def posts ( user_id : )
Post . where ( user_id : user_id )
end
end
# Define a schema
class Schema < GraphQL :: Schema
use GraphQL :: Execution :: Int
【文件预览】:
graphql-guard-master
----.travis.yml(144B)
----bin()
--------console(348B)
--------setup(131B)
----Rakefile(117B)
----graphql-guard.gemspec(1KB)
----Gemfile(183B)
----.rspec(31B)
----spec()
--------graphql()
--------spec_helper.rb(512B)
--------fixtures()
----.gitignore(141B)
----CHANGELOG.md(4KB)
----lib()
--------graphql()
----CODE_OF_CONDUCT.md(3KB)
----README.md(11KB)
----LICENSE.txt(1KB)