graphql-relay 0.8.0 → 0.8.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 263e38a956354abcb55e391c5bdd4b43367179db
|
4
|
+
data.tar.gz: ab2a35a584890faac7dac968c6c003ae5386168c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ec4c12612f83c3cfc806a1c8906aef9030354cb54701e5889eca89de0e9b02f75143feebaabc6e5779bf8e5c41fe3fa666f22ec7bcc5f8f286ed59d13b8e813
|
7
|
+
data.tar.gz: 90be05474c434fcdc4e8ec367e592ed063c0d66fe920e9d1dc7962f5643d8a2b73b1d0c71f4f3afc61175ea5f71d53c6b357a2eb88809b3a71a6b7907484a93d
|
data/README.md
CHANGED
@@ -97,7 +97,7 @@ NodeIdentification = GraphQL::Relay::GlobalNodeIdentification.define do
|
|
97
97
|
|
98
98
|
# Return a string for re-fetching this object
|
99
99
|
to_global_id -> (type_name, id) {
|
100
|
-
"#{type_name
|
100
|
+
"#{type_name}/#{id}"
|
101
101
|
}
|
102
102
|
|
103
103
|
# Based on the incoming string, extract the type_name and id
|
@@ -54,7 +54,7 @@ module GraphQL
|
|
54
54
|
input_field: GraphQL::Define::AssignArgument,
|
55
55
|
return_field: GraphQL::Define::AssignObjectField,
|
56
56
|
)
|
57
|
-
attr_accessor :name, :
|
57
|
+
attr_accessor :name, :description
|
58
58
|
attr_reader :fields, :arguments
|
59
59
|
|
60
60
|
# For backwards compat, but do we need this separate API?
|
@@ -98,13 +98,13 @@ describe GraphQL::Relay::GlobalNodeIdentification do
|
|
98
98
|
it "Applies custom-defined ID generation" do
|
99
99
|
result = query(%| { largestBase { id } }|)
|
100
100
|
generated_id = result["data"]["largestBase"]["id"]
|
101
|
-
assert_equal "Base/
|
101
|
+
assert_equal "Base/3", generated_id
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "fetching by ID" do
|
106
106
|
it "Deconstructs the ID by the custom proc" do
|
107
|
-
result = query(%| { node(id: "Base/
|
107
|
+
result = query(%| { node(id: "Base/1") { ... on Base { name } } }|)
|
108
108
|
base_name = result["data"]["node"]["name"]
|
109
109
|
assert_equal "Yavin", base_name
|
110
110
|
end
|
@@ -26,12 +26,11 @@ end
|
|
26
26
|
class Base < ActiveRecord::Base
|
27
27
|
end
|
28
28
|
|
29
|
-
Base.create(
|
30
|
-
Base.create(
|
31
|
-
Base.create(
|
32
|
-
Base.create(
|
33
|
-
Base.create(
|
34
|
-
|
29
|
+
Base.create!(name: "Yavin", planet: "Yavin 4", faction_id: 1)
|
30
|
+
Base.create!(name: "Echo Base", planet: "Hoth", faction_id: 1)
|
31
|
+
Base.create!(name: "Death Star", planet: nil, faction_id: 2)
|
32
|
+
Base.create!(name: "Shield Generator", planet: "Endor", faction_id: 2)
|
33
|
+
Base.create!(name: "Headquarters", planet: "Coruscant", faction_id: 2)
|
35
34
|
|
36
35
|
rebels = OpenStruct.new({
|
37
36
|
id: '1',
|
@@ -111,6 +111,7 @@ end
|
|
111
111
|
IntroduceShipMutation = GraphQL::Relay::Mutation.define do
|
112
112
|
# Used as the root for derived types:
|
113
113
|
name "IntroduceShip"
|
114
|
+
description "Add a ship to this faction"
|
114
115
|
|
115
116
|
# Nested under `input` in the query:
|
116
117
|
input_field :shipName, !types.String
|
@@ -140,7 +141,7 @@ QueryType = GraphQL::ObjectType.define do
|
|
140
141
|
end
|
141
142
|
|
142
143
|
field :largestBase, BaseType do
|
143
|
-
resolve -> (obj, args, ctx) { Base.find(
|
144
|
+
resolve -> (obj, args, ctx) { Base.find(3) }
|
144
145
|
end
|
145
146
|
|
146
147
|
field :node, field: NodeIdentification.field
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-relay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|