apollo-federation 1.0.3 → 1.0.4

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
  SHA256:
3
- metadata.gz: 0d3f90f1f5c832b3a29e663d64e80cc410b410c7c38dc04bf1eb7feb1d8bb5fa
4
- data.tar.gz: 28da5806afb3b73b607ad6e3e4fa949c9e81e3a3984d2a1e402bac97429dc209
3
+ metadata.gz: 9162a13344ba2374500711c42e7a3ae210bc12ba29747ab421e7b8bb2a8c36e4
4
+ data.tar.gz: 963f3b9efabca3efb67617598be416b6a0f6aa15bd630b25749093bf40b0bd6e
5
5
  SHA512:
6
- metadata.gz: b4748b68638d6051d49a78659a9a568b3bca5f4ac98d8628ff6e4edba281a0aaf5d6baef21f215f6d93e6dd3e2948b9826ca35495de64fdf10a59b745b26ed4c
7
- data.tar.gz: 1512dc028abf4cb815566b44ac1183081c872bfc7e4e50411a10fdc3fb9e9e8bfb949b5399884766defdd602220d5f248051f8fa478af90ce73fbbda77b31dcd
6
+ metadata.gz: 7a6a6ed04335cf873ba2a8589058d6960a4e1be29cc97deafab809c6bce682d7c66256290d56663b2e2f7bd5215e405f3c1a655f723494dfd1e39a9b97ded380
7
+ data.tar.gz: 0bcceb1c673ecbb8c1d934219f29364433b7bd4208bf6b9a69bfe465f732cb531680637dd7258f7e6f948527f5c8f8cd24b6a75f6f49d75918013db4e9ec929d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.4](https://github.com/Gusto/apollo-federation-ruby/compare/v1.0.3...v1.0.4) (2020-04-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fix spec to account for breaking change to graphql-ruby 1.10.0 ([#62](https://github.com/Gusto/apollo-federation-ruby/issues/62)) ([a631441](https://github.com/Gusto/apollo-federation-ruby/commit/a631441))
7
+
1
8
  ## [1.0.3](https://github.com/Gusto/apollo-federation-ruby/compare/v1.0.2...v1.0.3) (2020-03-25)
2
9
 
3
10
 
@@ -15,38 +15,42 @@ module ApolloFederation
15
15
  def to_graphql
16
16
  orig_defn = super
17
17
 
18
- if query.nil?
19
- base = GraphQL::Schema::Object
20
- else
21
- base = query.metadata[:type_class]
22
- end
23
-
24
- federation_query = Class.new(base) do
25
- graphql_name 'Query'
26
-
27
- include EntitiesField
28
- include ServiceField
29
- end
30
-
31
18
  possible_entities = orig_defn.types.values.select do |type|
32
19
  !type.introspection? && !type.default_scalar? && type.is_a?(GraphQL::ObjectType) &&
33
20
  type.metadata[:federation_directives]&.any? { |directive| directive[:name] == 'key' }
34
21
  end
35
22
 
23
+ @query_object = federation_query
24
+
36
25
  if !possible_entities.empty?
37
26
  entity_type = Class.new(Entity) do
38
27
  possible_types(*possible_entities)
39
28
  end
40
29
  # TODO: Should/can we encapsulate all of this inside the module? What's the best/most Ruby
41
30
  # way to split this out?
42
- federation_query.define_entities_field(entity_type)
31
+ @query_object.define_entities_field(entity_type)
43
32
  end
44
33
 
45
- query(federation_query)
46
-
47
34
  super
48
35
  end
49
36
 
37
+ def federation_query
38
+ if query.nil?
39
+ base = GraphQL::Schema::Object
40
+ elsif Gem::Version.new(GraphQL::VERSION) >= Gem::Version.new('1.10.0')
41
+ base = query
42
+ else
43
+ base = query.metadata[:type_class]
44
+ end
45
+
46
+ Class.new(base) do
47
+ graphql_name 'Query'
48
+
49
+ include EntitiesField
50
+ include ServiceField
51
+ end
52
+ end
53
+
50
54
  def federation_sdl(context: nil)
51
55
  document_from_schema = FederatedDocumentFromSchemaDefinition.new(self, context: context)
52
56
  GraphQL::Language::Printer.new.print(document_from_schema.document)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
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: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noa Elad
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-25 00:00:00.000000000 Z
12
+ date: 2020-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.9.8
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.9.8
28
28
  - !ruby/object:Gem::Dependency