apollo-federation 3.6.8 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26437191f63f4ce0a56dff61e303ffa903ff80df46db23d5840ded158cdef18c
4
- data.tar.gz: c19bf4aeb4d78298d0d210ad2078b08d01a8e2fd4de75f5f5d2caccadbaa315d
3
+ metadata.gz: 7a3acf99a330df8e02ac0217773a9443b400d97a1ad47ed518a2f5631499711f
4
+ data.tar.gz: f9482d80b73b9ba0396fc51676a1ab28a12910c6a7fc3b7666421efff705a1ef
5
5
  SHA512:
6
- metadata.gz: '079095e454e865dfceacb37c16e3ce64a23d59f5d937aa8668f7264b8f89ade841df7104b547ced1e4c353f3f81457e793882087b30baaad7d82ffb7c2ce8524'
7
- data.tar.gz: 79e15b6604c5f127e0948f4641c8530e4c538a5a587c6fb944a9b5ad874cb3564baf077dba26f1321fbe0580e61d0a157743cbbebfd1874e682c15a250e2dc8b
6
+ metadata.gz: 10f57a06a03f32dec83f3fbbd293c695a8019914b577b5ae25e6fedd86fa0d0e27be640ccc9261a5fed2f22154535e39d9d9408bfd16cce016ff2bd9cea7beda
7
+ data.tar.gz: c7bc892658495ae8576159aa0c14be88837744bfde4dbcd30acb15b443eb817b17400e49f8cd46c59e161ac5975374e84f5405bb30eb8f0280fd80dc2a646f51
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.7.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.9...v3.7.0) (2023-05-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * support [@key](https://github.com/key) directive resolvable argument ([#249](https://github.com/Gusto/apollo-federation-ruby/issues/249)) ([6df7030](https://github.com/Gusto/apollo-federation-ruby/commit/6df70305d3e6035946c9ac35d74387014b08b28a))
7
+
8
+ ## [3.6.9](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.8...v3.6.9) (2023-05-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * visibility checks should handle duplicate types and fields ([#245](https://github.com/Gusto/apollo-federation-ruby/issues/245)) ([6401feb](https://github.com/Gusto/apollo-federation-ruby/commit/6401febe65743eb1fae970b3cf865b7007fb27cf))
14
+
1
15
  ## [3.6.8](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.7...v3.6.8) (2023-05-22)
2
16
 
3
17
 
data/README.md CHANGED
@@ -178,6 +178,14 @@ class User < BaseObject
178
178
  end
179
179
  ```
180
180
 
181
+ As well as non-resolvable keys:
182
+
183
+ ```ruby
184
+ class User < BaseObject
185
+ key fields: :id, resolvable: false
186
+ end
187
+ ```
188
+
181
189
  See [field set syntax](#field-set-syntax) for more details on the format of the `fields` option.
182
190
 
183
191
  ### The `@external` directive
@@ -69,7 +69,7 @@ module ApolloFederation
69
69
  def build_type_definition_nodes(types)
70
70
  non_federation_types = types.select do |type|
71
71
  if query_type?(type)
72
- !type.fields.values.all? { |field| FEDERATION_QUERY_FIELDS.include?(field.graphql_name) }
72
+ !warden.fields(type).all? { |field| FEDERATION_QUERY_FIELDS.include?(field.graphql_name) }
73
73
  else
74
74
  !FEDERATION_TYPES.include?(type.graphql_name)
75
75
  end
@@ -32,13 +32,15 @@ module ApolloFederation
32
32
  add_directive(name: 'tag', arguments: [name: 'name', values: name])
33
33
  end
34
34
 
35
- def key(fields:, camelize: true)
35
+ def key(fields:, camelize: true, resolvable: true)
36
+ arguments = [
37
+ name: 'fields',
38
+ values: ApolloFederation::FieldSetSerializer.serialize(fields, camelize: camelize),
39
+ ]
40
+ arguments.append(name: 'resolvable', values: resolvable) unless resolvable
36
41
  add_directive(
37
42
  name: 'key',
38
- arguments: [
39
- name: 'fields',
40
- values: ApolloFederation::FieldSetSerializer.serialize(fields, camelize: camelize),
41
- ],
43
+ arguments: arguments,
42
44
  )
43
45
  end
44
46
  end
@@ -81,9 +81,9 @@ module ApolloFederation
81
81
 
82
82
  # Walk through all of the types and determine which ones are entities (any type with a
83
83
  # "key" directive)
84
- types_schema.types.values.select do |type|
84
+ types_schema.send(:non_introspection_types).values.flatten.select do |type|
85
85
  # TODO: Interfaces can have a key...
86
- !type.introspection? && type.include?(ApolloFederation::Object) &&
86
+ type.include?(ApolloFederation::Object) &&
87
87
  type.federation_directives&.any? { |directive| directive[:name] == 'key' }
88
88
  end
89
89
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '3.6.8'
4
+ VERSION = '3.7.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo-federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.8
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noa Elad
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-22 00:00:00.000000000 Z
12
+ date: 2023-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql