graphql_schema 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/graphql_schema.gemspec +1 -1
- data/lib/graphql_schema.rb +32 -4
- data/lib/graphql_schema/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6bb27ea8446623bec1c7ab56efe9255026f0b9038d75197c171da7420daf3d0a
|
4
|
+
data.tar.gz: d2fc1659a41b311cc8aa40f576b7f0a429fd7c16f2d2dadd43526d4e0457a64a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aacedad3fabab90e55d4023c43e026b783f8176059deb21408fb6555d76a8b10a956d03a2398f02ea094a0fd34466fcebe20f5d0d38e2c184e0effecd076fa98
|
7
|
+
data.tar.gz: da7e757dd0fdf7236fa8380127ec4f1d418fc59a66e9438cca9fb09d3a52b6110804513f51bd9d7039440b750a197b0a892e92b255b0f9811dbc2628f5cbc47c
|
data/graphql_schema.gemspec
CHANGED
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.bindir = "exe"
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
22
23
|
|
23
24
|
spec.add_development_dependency "graphql", "~> 1.2"
|
24
25
|
spec.add_development_dependency "byebug", '~> 9.0' if RUBY_ENGINE == 'ruby'
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.12"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "minitest", "~> 5.0"
|
28
28
|
end
|
data/lib/graphql_schema.rb
CHANGED
@@ -20,6 +20,12 @@ class GraphQLSchema
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def directives
|
24
|
+
@directives ||= @hash.fetch('directives').map do |directive|
|
25
|
+
Directive.new(directive)
|
26
|
+
end.sort_by(&:name)
|
27
|
+
end
|
28
|
+
|
23
29
|
def types
|
24
30
|
@types ||= @hash.fetch('types').map{ |type_hash| TypeDefinition.new(type_hash) }.sort_by(&:name)
|
25
31
|
end
|
@@ -28,6 +34,12 @@ class GraphQLSchema
|
|
28
34
|
@types_by_name ||= types.map { |type| [type.name, type] }.to_h
|
29
35
|
end
|
30
36
|
|
37
|
+
module WithArgs
|
38
|
+
def args
|
39
|
+
@args ||= @hash.fetch('args').map{ |arg_hash| InputValue.new(arg_hash) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
31
43
|
module NamedHash
|
32
44
|
def name
|
33
45
|
@hash.fetch('name')
|
@@ -93,15 +105,12 @@ class GraphQLSchema
|
|
93
105
|
class Field
|
94
106
|
include NamedHash
|
95
107
|
include Deprecatable
|
108
|
+
include WithArgs
|
96
109
|
|
97
110
|
def initialize(field_hash)
|
98
111
|
@hash = field_hash
|
99
112
|
end
|
100
113
|
|
101
|
-
def args
|
102
|
-
@args ||= @hash.fetch('args').map{ |arg_hash| InputValue.new(arg_hash) }
|
103
|
-
end
|
104
|
-
|
105
114
|
def required_args
|
106
115
|
@required_args ||= args.select{ |arg| arg.type.non_null? }
|
107
116
|
end
|
@@ -214,6 +223,25 @@ class GraphQLSchema
|
|
214
223
|
end
|
215
224
|
end
|
216
225
|
|
226
|
+
class Directive
|
227
|
+
include NamedHash
|
228
|
+
include WithArgs
|
229
|
+
|
230
|
+
BUILTIN = %w(skip include deprecated).to_set
|
231
|
+
|
232
|
+
def initialize(directive)
|
233
|
+
@hash = directive
|
234
|
+
end
|
235
|
+
|
236
|
+
def locations
|
237
|
+
@hash.fetch('locations')
|
238
|
+
end
|
239
|
+
|
240
|
+
def builtin?
|
241
|
+
BUILTIN.include?(name)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
217
245
|
class TypeDefinition < Type
|
218
246
|
def fields(include_deprecated: false)
|
219
247
|
return unless @hash.fetch('fields')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Thacker-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '9.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.12'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.12'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,7 +88,8 @@ files:
|
|
102
88
|
homepage: https://github.com/Shopify/graphql_schema
|
103
89
|
licenses:
|
104
90
|
- MIT
|
105
|
-
metadata:
|
91
|
+
metadata:
|
92
|
+
allowed_push_host: https://rubygems.org
|
106
93
|
post_install_message:
|
107
94
|
rdoc_options: []
|
108
95
|
require_paths:
|
@@ -118,8 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
105
|
- !ruby/object:Gem::Version
|
119
106
|
version: '0'
|
120
107
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.5.2
|
108
|
+
rubygems_version: 3.2.17
|
123
109
|
signing_key:
|
124
110
|
specification_version: 4
|
125
111
|
summary: Classes for convenient use of GraphQL introspection result
|