apollo-federation 0.4.2 → 0.5.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +11 -0
- data/lib/apollo-federation.rb +1 -0
- data/lib/apollo-federation/federated_document_from_schema_definition.rb +5 -0
- data/lib/apollo-federation/interface.rb +31 -0
- data/lib/apollo-federation/object.rb +0 -1
- data/lib/apollo-federation/schema.rb +1 -1
- data/lib/apollo-federation/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee348cd629e831432a5500ed0396962f5bcb614570aaaded9c017acffe89c716
|
4
|
+
data.tar.gz: cf5a7bcc824e67dbd5ae431b6a05d575d0d501e2ce44410607bddf313917f543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4bcaebf99a78f3f9b3af9b085cbcd908c00ffcabc5e23caf23f55341cd46ad9b86cd735b43701742c671a9547c2ef3536fbcf7211d0b27b9ede8c8d39ed338
|
7
|
+
data.tar.gz: aa35f034de34453234a2d71a8e00cccbe435264efd0e277120a3c82531d9deb0035976420ee7c7ad415dc0ddfa8574537687cf863842c9d75021ec74f54843d8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.5.0](https://github.com/Gusto/apollo-federation-ruby/compare/v0.4.2...v0.5.0) (2019-10-22)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Support Interfaces ([#27](https://github.com/Gusto/apollo-federation-ruby/issues/27)) ([33d0097](https://github.com/Gusto/apollo-federation-ruby/commit/33d0097))
|
7
|
+
|
1
8
|
## [0.4.2](https://github.com/Gusto/apollo-federation-ruby/compare/v0.4.1...v0.4.2) (2019-10-21)
|
2
9
|
|
3
10
|
|
data/README.md
CHANGED
@@ -44,6 +44,17 @@ class BaseObject < GraphQL::Schema::Object
|
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
|
+
Include the `ApolloFederation::Interface` module in your base interface module:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
module BaseInterface
|
51
|
+
include GraphQL::Schema::Interface
|
52
|
+
include ApolloFederation::Interface
|
53
|
+
|
54
|
+
field_class BaseField
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
47
58
|
Finally, include the `ApolloFederation::Schema` module in your schema:
|
48
59
|
|
49
60
|
```ruby
|
data/lib/apollo-federation.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'apollo-federation/version'
|
4
4
|
require 'apollo-federation/schema'
|
5
5
|
require 'apollo-federation/object'
|
6
|
+
require 'apollo-federation/interface'
|
6
7
|
require 'apollo-federation/field'
|
7
8
|
require 'apollo-federation/tracing/proto'
|
8
9
|
require 'apollo-federation/tracing/node_map'
|
@@ -26,6 +26,11 @@ module ApolloFederation
|
|
26
26
|
merge_directives(object_node, object_type.metadata[:federation_directives])
|
27
27
|
end
|
28
28
|
|
29
|
+
def build_interface_type_node(interface_type)
|
30
|
+
field_node = super
|
31
|
+
merge_directives(field_node, interface_type.metadata[:federation_directives])
|
32
|
+
end
|
33
|
+
|
29
34
|
def build_field_node(field_type)
|
30
35
|
field_node = super
|
31
36
|
merge_directives(field_node, field_type.metadata[:federation_directives])
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'apollo-federation/has_directives'
|
4
|
+
|
5
|
+
module ApolloFederation
|
6
|
+
module Interface
|
7
|
+
def self.included(klass)
|
8
|
+
klass.definition_methods do
|
9
|
+
include DefinitionMethods
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module DefinitionMethods
|
14
|
+
include HasDirectives
|
15
|
+
|
16
|
+
def extend_type
|
17
|
+
add_directive(name: 'extends')
|
18
|
+
end
|
19
|
+
|
20
|
+
def key(fields:)
|
21
|
+
add_directive(
|
22
|
+
name: 'key',
|
23
|
+
arguments: [
|
24
|
+
name: 'fields',
|
25
|
+
values: fields,
|
26
|
+
],
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -29,7 +29,7 @@ module ApolloFederation
|
|
29
29
|
end
|
30
30
|
|
31
31
|
possible_entities = orig_defn.types.values.select do |type|
|
32
|
-
!type.introspection? && !type.default_scalar? &&
|
32
|
+
!type.introspection? && !type.default_scalar? && type.is_a?(GraphQL::ObjectType) &&
|
33
33
|
type.metadata[:federation_directives]&.any? { |directive| directive[:name] == 'key' }
|
34
34
|
end
|
35
35
|
|
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: 0.
|
4
|
+
version: 0.5.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: 2019-10-
|
12
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/apollo-federation/federated_document_from_schema_definition.rb
|
160
160
|
- lib/apollo-federation/field.rb
|
161
161
|
- lib/apollo-federation/has_directives.rb
|
162
|
+
- lib/apollo-federation/interface.rb
|
162
163
|
- lib/apollo-federation/object.rb
|
163
164
|
- lib/apollo-federation/schema.rb
|
164
165
|
- lib/apollo-federation/service.rb
|