apollo-federation 3.1.0 → 3.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe0ae888b83a68558821badedaaacc8c2e175dbf1aff918f347ec7ca797d8c0a
|
4
|
+
data.tar.gz: ceae483d68658009536a64de692473cebad87d0810027c7c80219df52b7d8cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3aaba325f9d53ceef358dc287963afe2374ca75d9a6cd3e2b988c9e008e47496238b81eb59c538d4bbb2693a967a52ce72c8efb8c643321480692b3b7666d6c
|
7
|
+
data.tar.gz: 8ed45a0a43cf239ddbb6dbdd8f4375f209efec48f5d9f17282b83b564e9d98c6b41bab51bbaf622b57265ed2d1a93bacacf9e71da54b1205b07c9a3fa762f56a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [3.2.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.1.0...v3.2.0) (2022-08-15)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* allow custom namespace for linked directives ([03fdfea](https://github.com/Gusto/apollo-federation-ruby/commit/03fdfeafaaea3c98ca4b7a734ce760ea08410530))
|
7
|
+
|
1
8
|
# [3.1.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.0.0...v3.1.0) (2022-06-21)
|
2
9
|
|
3
10
|
|
@@ -62,13 +62,21 @@ module ApolloFederation
|
|
62
62
|
|
63
63
|
directives.each do |directive|
|
64
64
|
node = node.merge_directive(
|
65
|
-
name:
|
65
|
+
name: directive_name(directive),
|
66
66
|
arguments: build_arguments_node(directive[:arguments]),
|
67
67
|
)
|
68
68
|
end
|
69
69
|
node
|
70
70
|
end
|
71
71
|
|
72
|
+
def directive_name(directive)
|
73
|
+
if schema.federation_2?
|
74
|
+
"#{schema.link_namespace}__#{directive[:name]}"
|
75
|
+
else
|
76
|
+
directive[:name]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
72
80
|
def build_arguments_node(arguments)
|
73
81
|
(arguments || []).map do |arg|
|
74
82
|
GraphQL::Language::Nodes::Argument.new(name: arg[:name], value: arg[:values])
|
@@ -18,8 +18,9 @@ module ApolloFederation
|
|
18
18
|
|
19
19
|
SCHEMA
|
20
20
|
|
21
|
-
def federation(version: '1.0')
|
21
|
+
def federation(version: '1.0', link: {})
|
22
22
|
@federation_version = version
|
23
|
+
@link = { as: 'federation' }.merge(link)
|
23
24
|
end
|
24
25
|
|
25
26
|
def federation_version
|
@@ -38,6 +39,10 @@ module ApolloFederation
|
|
38
39
|
output
|
39
40
|
end
|
40
41
|
|
42
|
+
def link_namespace
|
43
|
+
@link[:as]
|
44
|
+
end
|
45
|
+
|
41
46
|
def query(new_query_object = nil)
|
42
47
|
if new_query_object
|
43
48
|
@orig_query_object = new_query_object
|
@@ -55,6 +60,14 @@ module ApolloFederation
|
|
55
60
|
|
56
61
|
private
|
57
62
|
|
63
|
+
def federation_2_prefix
|
64
|
+
<<~SCHEMA
|
65
|
+
extend schema
|
66
|
+
@link(url: "https://specs.apollo.dev/federation/v2.0", as: "#{link_namespace}")
|
67
|
+
|
68
|
+
SCHEMA
|
69
|
+
end
|
70
|
+
|
58
71
|
def schema_entities
|
59
72
|
# Create a temporary schema that inherits from this one to extract the types
|
60
73
|
types_schema = Class.new(self)
|
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.
|
4
|
+
version: 3.2.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: 2022-
|
12
|
+
date: 2022-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|