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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96bef39c8a37b049f8843e78d2f15f1c10430d16
4
- data.tar.gz: 23c0c140f6e0bba9fc17468b702102d61cd48044
3
+ metadata.gz: 0f7fde27f1042e7ab45a94bf130bd0bf6575fdde
4
+ data.tar.gz: 22ce0c200aafaf86c07305fc576629df0c739edb
5
5
  SHA512:
6
- metadata.gz: f5e3451aa0669e2896255851dcfdae11fae11e190db815d2b322076915633f482eef27749374cdab094fdd456ba6420afce12b075f25a71aa709da57374184f3
7
- data.tar.gz: 442f220e5edf3087e9bc4fed9fa263096a551c66d88d01f03d58fe431eee72a7fb9067a54569d4f33768a2ebb274f8ec91e4492223281febe29eb12164039c87
6
+ metadata.gz: 4977dac7e103cebfded6ce613df88651bc5f24a977067a432b3609bb0c3d3e8d7ea90bb161401c7de510cac552582c0c7a396945d8980b2af43e2178fca60e32
7
+ data.tar.gz: a18ad101dbc96bef323c38a2f07e92e1f46a7addbe5dcb0035db6995b4ce399d87acaf3b688b94742f572ee0c4abe20765afc09cfe623a6defc5318466fc9eff
@@ -47,6 +47,8 @@ module GraphQL
47
47
  fields[field_name]
48
48
  end
49
49
 
50
+ # These fields don't have instrumenation applied
51
+ # @see [Schema#get_fields] Get fields with instrumentation
50
52
  # @return [Array<GraphQL::Field>] All fields on this type
51
53
  def all_fields
52
54
  fields.values
@@ -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
@@ -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
@@ -29,8 +29,11 @@ module GraphQL
29
29
  end
30
30
 
31
31
  def get(type_name, field_name)
32
- type = @storage[type_name]
33
- type && type[field_name]
32
+ @storage[type_name][field_name]
33
+ end
34
+
35
+ def get_all(type_name)
36
+ @storage[type_name]
34
37
  end
35
38
  end
36
39
  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.all_fields.select { |f| visible_field?(f) } }
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
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.5.8"
3
+ VERSION = "1.5.9"
4
4
  end
@@ -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.8
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-18 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips