apollo-federation 3.5.2 → 3.6.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: 8674286a181f04894788b8e1b1ff064dfb2b7a9db566cff6ac31b770821342dc
4
- data.tar.gz: 6405fb1eb377c4821f3528b7c69b4ab714564d6739f1020737a4de03e358e7b0
3
+ metadata.gz: b48438a1b967fedac245550c5e46d887f7c4978d54736d90ba14aef61be5d4b7
4
+ data.tar.gz: 982dd4cc577d286793e57aef3ba63cab338a48e7034bd3c65aaacd1367b64b40
5
5
  SHA512:
6
- metadata.gz: 5799c75a497544ac66591c62020f340e7ca0c44617aefa3076118421d9b0a51eb9a57fafe0b67d3c6753ec9e6d904f2b8f069fc61387b25bf42562d81aeb3c50
7
- data.tar.gz: 9929c3f176c3b33d94abdb09a777121909fa353019e0ad4ba2862176e35e77ca1f3fb74edf30b5c283f1f1f99ffadf6a70931e7c62c733a1623e32a051783e33
6
+ metadata.gz: 18c9bd5dbdce6fa9b526fbc1df531a6a435c00d42ea8ac097ad008d32c748b910e2145a0832a03b630190cfaad0a2a9a7121a47f45eacee253132d46255f9a89
7
+ data.tar.gz: 415f518015e14e6a833643796748edd3ae1835678d6d1cf3f13920b903061193ae8caec3ef7975fc3ab63c9df4cc1e9853211c5e5374c2466df367515ca29d20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # [3.6.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.5.3...v3.6.0) (2023-03-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * attempt to fix missing CHANGELOG entries ([07170d3](https://github.com/Gusto/apollo-federation-ruby/commit/07170d39738bec59952b0b952431ee2aecbf8f89))
7
+
8
+ ## [3.5.3](https://github.com/Gusto/apollo-federation-ruby/compare/v3.5.2...v3.5.3) (2023-03-17)
9
+
10
+
11
+ ### Features
12
+
13
+ * Support @inaccessible on remaining types ([#230](https://github.com/Gusto/apollo-federation-ruby/pull/230)) ([b62e6d9](https://github.com/Gusto/apollo-federation-ruby/commit/b62e6d9fc5ad0acae00746a80a622ac22dfa0c1f))
14
+
15
+ ### Bug Fixes
16
+
17
+ * Inherit federation directives ([#94](https://github.com/Gusto/apollo-federation-ruby/issues/94)) ([822f92b](https://github.com/Gusto/apollo-federation-ruby/commit/822f92b229f3437c474721082033b74c8cc63553))
18
+
1
19
  ## [3.5.2](https://github.com/Gusto/apollo-federation-ruby/compare/v3.5.1...v3.5.2) (2023-03-08)
2
20
 
3
21
 
data/README.md CHANGED
@@ -22,13 +22,21 @@ Or install it yourself as:
22
22
 
23
23
  ## Getting Started
24
24
 
25
- Include the `ApolloFederation::Field` module in your base field class:
25
+ Include the `ApolloFederation::Argument` module in your base argument class:
26
26
 
27
27
  ```ruby
28
- require 'apollo-federation'
28
+ class BaseArgument < GraphQL::Schema::Argument
29
+ include ApolloFederation::Argument
30
+ end
31
+ ```
32
+
33
+ Include the `ApolloFederation::Field` module in your base field class:
29
34
 
35
+ ```ruby
30
36
  class BaseField < GraphQL::Schema::Field
31
37
  include ApolloFederation::Field
38
+
39
+ argument_class BaseArgument
32
40
  end
33
41
  ```
34
42
 
@@ -53,6 +61,50 @@ module BaseInterface
53
61
  end
54
62
  ```
55
63
 
64
+ Include the `ApolloFederation::Union` module in your base union class:
65
+
66
+ ```ruby
67
+ class BaseUnion < GraphQL::Schema::Union
68
+ include ApolloFederation::Union
69
+ end
70
+ ```
71
+
72
+ Include the `ApolloFederation::EnumValue` module in your base enum value class:
73
+
74
+ ```ruby
75
+ class BaseEnumValue < GraphQL::Schema::EnumValue
76
+ include ApolloFederation::EnumValue
77
+ end
78
+ ```
79
+
80
+ Include the `ApolloFederation::Enum` module in your base enum class:
81
+
82
+ ```ruby
83
+ class BaseEnum < GraphQL::Schema::Enum
84
+ include ApolloFederation::Enum
85
+
86
+ enum_value_class BaseEnumValue
87
+ end
88
+ ```
89
+
90
+ Include the `ApolloFederation::InputObject` module in your base input object class:
91
+
92
+ ```ruby
93
+ class BaseInputObject < GraphQL::Schema::InputObject
94
+ include ApolloFederation::InputObject
95
+
96
+ argument_class BaseArgument
97
+ end
98
+ ```
99
+
100
+ Include the `ApolloFederation::Scalar` module in your base scalar class:
101
+
102
+ ```ruby
103
+ class BaseScalar < GraphQL::Schema::Scalar
104
+ include ApolloFederation::Scalar
105
+ end
106
+ ```
107
+
56
108
  Finally, include the `ApolloFederation::Schema` module in your schema:
57
109
 
58
110
  ```ruby
@@ -6,7 +6,7 @@ module ApolloFederation
6
6
  module Argument
7
7
  include HasDirectives
8
8
 
9
- VERSION_2_DIRECTIVES = %i[tags].freeze
9
+ VERSION_2_DIRECTIVES = %i[tags inaccessible].freeze
10
10
 
11
11
  def initialize(*args, **kwargs, &block)
12
12
  add_v2_directives(**kwargs)
@@ -22,7 +22,7 @@ module ApolloFederation
22
22
 
23
23
  private
24
24
 
25
- def add_v2_directives(tags: [], **_kwargs)
25
+ def add_v2_directives(tags: [], inaccessible: nil, **_kwargs)
26
26
  tags.each do |tag|
27
27
  add_directive(
28
28
  name: 'tag',
@@ -32,6 +32,8 @@ module ApolloFederation
32
32
  ],
33
33
  )
34
34
  end
35
+
36
+ add_directive(name: 'inaccessible') if inaccessible
35
37
  end
36
38
  end
37
39
  end
@@ -14,6 +14,10 @@ module ApolloFederation
14
14
  def tag(name:)
15
15
  add_directive(name: 'tag', arguments: [name: 'name', values: name])
16
16
  end
17
+
18
+ def inaccessible
19
+ add_directive(name: 'inaccessible')
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -6,7 +6,7 @@ module ApolloFederation
6
6
  module EnumValue
7
7
  include HasDirectives
8
8
 
9
- VERSION_2_DIRECTIVES = %i[tags].freeze
9
+ VERSION_2_DIRECTIVES = %i[tags inaccessible].freeze
10
10
 
11
11
  def initialize(*args, **kwargs, &block)
12
12
  add_v2_directives(**kwargs)
@@ -22,7 +22,7 @@ module ApolloFederation
22
22
 
23
23
  private
24
24
 
25
- def add_v2_directives(tags: [], **_kwargs)
25
+ def add_v2_directives(tags: [], inaccessible: nil, **_kwargs)
26
26
  tags.each do |tag|
27
27
  add_directive(
28
28
  name: 'tag',
@@ -32,6 +32,8 @@ module ApolloFederation
32
32
  ],
33
33
  )
34
34
  end
35
+
36
+ add_directive(name: 'inaccessible') if inaccessible
35
37
  end
36
38
  end
37
39
  end
@@ -2,11 +2,20 @@
2
2
 
3
3
  module ApolloFederation
4
4
  module HasDirectives
5
- attr_reader :federation_directives
6
-
7
5
  def add_directive(name:, arguments: nil)
8
- @federation_directives ||= []
9
- @federation_directives << { name: name, arguments: arguments }
6
+ own_federation_directives << { name: name, arguments: arguments }
7
+ end
8
+
9
+ def federation_directives
10
+ if is_a?(Class)
11
+ own_federation_directives + find_inherited_value(:federation_directives, [])
12
+ else
13
+ own_federation_directives
14
+ end
15
+ end
16
+
17
+ def own_federation_directives
18
+ @own_federation_directives ||= []
10
19
  end
11
20
  end
12
21
  end
@@ -14,6 +14,10 @@ module ApolloFederation
14
14
  def tag(name:)
15
15
  add_directive(name: 'tag', arguments: [name: 'name', values: name])
16
16
  end
17
+
18
+ def inaccessible
19
+ add_directive(name: 'inaccessible')
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -14,6 +14,10 @@ module ApolloFederation
14
14
  def tag(name:)
15
15
  add_directive(name: 'tag', arguments: [name: 'name', values: name])
16
16
  end
17
+
18
+ def inaccessible
19
+ add_directive(name: 'inaccessible')
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -22,7 +22,7 @@ module ApolloFederation
22
22
  end
23
23
 
24
24
  def federation_version
25
- @federation_version || '1.0'
25
+ @federation_version || find_inherited_value(:federation_version, '1.0')
26
26
  end
27
27
 
28
28
  def federation_2?
@@ -38,7 +38,7 @@ module ApolloFederation
38
38
  end
39
39
 
40
40
  def link_namespace
41
- @link[:as]
41
+ @link ? @link[:as] : find_inherited_value(:link_namespace)
42
42
  end
43
43
 
44
44
  def query(new_query_object = nil)
@@ -14,6 +14,10 @@ module ApolloFederation
14
14
  def tag(name:)
15
15
  add_directive(name: 'tag', arguments: [name: 'name', values: name])
16
16
  end
17
+
18
+ def inaccessible
19
+ add_directive(name: 'inaccessible')
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '3.5.2'
4
+ VERSION = '3.6.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.5.2
4
+ version: 3.6.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-03-08 00:00:00.000000000 Z
12
+ date: 2023-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql