apollo-federation 3.5.2 → 3.5.3

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: 8674286a181f04894788b8e1b1ff064dfb2b7a9db566cff6ac31b770821342dc
4
- data.tar.gz: 6405fb1eb377c4821f3528b7c69b4ab714564d6739f1020737a4de03e358e7b0
3
+ metadata.gz: 97086cad340406643d155dd88a41eb47961b98c8c3681153a1845b36c18d4eb6
4
+ data.tar.gz: 9d9eea749974ca35aade23e0091c655973bf7e3a4315c28f2094530e634a4c8e
5
5
  SHA512:
6
- metadata.gz: 5799c75a497544ac66591c62020f340e7ca0c44617aefa3076118421d9b0a51eb9a57fafe0b67d3c6753ec9e6d904f2b8f069fc61387b25bf42562d81aeb3c50
7
- data.tar.gz: 9929c3f176c3b33d94abdb09a777121909fa353019e0ad4ba2862176e35e77ca1f3fb74edf30b5c283f1f1f99ffadf6a70931e7c62c733a1623e32a051783e33
6
+ metadata.gz: b5c4ddc7850e680bc751a3ca02eaca4a351e6a32eb8d5abe57b5a0fe596f1fd4627c1370345037bc152c7a24ab22e9360b358e2ed95859336895136315103466
7
+ data.tar.gz: 30fa2aa83ec1fc4f701347e8c6157042d31283e81756117392a6988a79b95a9397079a36159b30348c678eb0c2d99e73ab163ce6f697a204780e9c489e82e71c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.5.3](https://github.com/Gusto/apollo-federation-ruby/compare/v3.5.2...v3.5.3) (2023-03-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Inherit federation directives ([#94](https://github.com/Gusto/apollo-federation-ruby/issues/94)) ([822f92b](https://github.com/Gusto/apollo-federation-ruby/commit/822f92b229f3437c474721082033b74c8cc63553))
7
+
1
8
  ## [3.5.2](https://github.com/Gusto/apollo-federation-ruby/compare/v3.5.1...v3.5.2) (2023-03-08)
2
9
 
3
10
 
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.5.3'
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.5.3
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