graphql 1.5.8 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/interface_type.rb +2 -0
- data/lib/graphql/object_type.rb +4 -0
- data/lib/graphql/schema.rb +6 -0
- data/lib/graphql/schema/instrumented_field_map.rb +5 -2
- data/lib/graphql/schema/warden.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/introspection/type_type_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f7fde27f1042e7ab45a94bf130bd0bf6575fdde
|
4
|
+
data.tar.gz: 22ce0c200aafaf86c07305fc576629df0c739edb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4977dac7e103cebfded6ce613df88651bc5f24a977067a432b3609bb0c3d3e8d7ea90bb161401c7de510cac552582c0c7a396945d8980b2af43e2178fca60e32
|
7
|
+
data.tar.gz: a18ad101dbc96bef323c38a2f07e92e1f46a7addbe5dcb0035db6995b4ce399d87acaf3b688b94742f572ee0c4abe20765afc09cfe623a6defc5318466fc9eff
|
data/lib/graphql/object_type.rb
CHANGED
@@ -73,11 +73,15 @@ module GraphQL
|
|
73
73
|
GraphQL::TypeKinds::OBJECT
|
74
74
|
end
|
75
75
|
|
76
|
+
# This fields doesnt have instrumenation applied
|
77
|
+
# @see [Schema#get_field] Get field with instrumentation
|
76
78
|
# @return [GraphQL::Field] The field definition for `field_name` (may be inherited from interfaces)
|
77
79
|
def get_field(field_name)
|
78
80
|
fields[field_name] || interface_fields[field_name]
|
79
81
|
end
|
80
82
|
|
83
|
+
# These fields don't have instrumenation applied
|
84
|
+
# @see [Schema#get_fields] Get fields with instrumentation
|
81
85
|
# @return [Array<GraphQL::Field>] All fields, including ones inherited from interfaces
|
82
86
|
def all_fields
|
83
87
|
interface_fields.merge(self.fields).values
|
data/lib/graphql/schema.rb
CHANGED
@@ -238,6 +238,12 @@ module GraphQL
|
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
|
+
# Fields for this type, after instrumentation is applied
|
242
|
+
# @return [Hash<String, GraphQL::Field>]
|
243
|
+
def get_fields(type)
|
244
|
+
@instrumented_field_map.get_all(type.name)
|
245
|
+
end
|
246
|
+
|
241
247
|
def type_from_ast(ast_node)
|
242
248
|
GraphQL::Schema::TypeExpression.build_type(self.types, ast_node)
|
243
249
|
end
|
@@ -92,7 +92,7 @@ module GraphQL
|
|
92
92
|
# @param type_defn [GraphQL::ObjectType, GraphQL::InterfaceType]
|
93
93
|
# @return [Array<GraphQL::Field>] Fields on `type_defn`
|
94
94
|
def fields(type_defn)
|
95
|
-
@visible_fields ||= read_through { |t| t.
|
95
|
+
@visible_fields ||= read_through { |t| @schema.get_fields(t).each_value.select { |f| visible_field?(f) } }
|
96
96
|
@visible_fields[type_defn]
|
97
97
|
end
|
98
98
|
|
data/lib/graphql/version.rb
CHANGED
@@ -128,6 +128,28 @@ describe GraphQL::Introspection::TypeType do
|
|
128
128
|
}}
|
129
129
|
assert_equal(expected, result)
|
130
130
|
end
|
131
|
+
|
132
|
+
it "includes Relay fields" do
|
133
|
+
res = StarWars::Schema.execute <<-GRAPHQL
|
134
|
+
{
|
135
|
+
__schema {
|
136
|
+
types {
|
137
|
+
name
|
138
|
+
fields {
|
139
|
+
name
|
140
|
+
args { name }
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
GRAPHQL
|
146
|
+
|
147
|
+
type_result = res["data"]["__schema"]["types"].find { |t| t["name"] == "Faction" }
|
148
|
+
field_result = type_result["fields"].find { |f| f["name"] == "bases" }
|
149
|
+
all_arg_names = ["first", "after", "last", "before", "nameIncludes"]
|
150
|
+
returned_arg_names = field_result["args"].map { |a| a["name"] }
|
151
|
+
assert_equal all_arg_names, returned_arg_names
|
152
|
+
end
|
131
153
|
end
|
132
154
|
end
|
133
155
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|