graphql_rails 2.1.0 → 2.2.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: bd5007444af16b72661bd4c9ad03866017b9fbbaadbd4a4bccc5c788c73f95bf
4
- data.tar.gz: 884390854d3490c9b323f82c527b922a087a0617a1a862fb5cbcd3d18f31e955
3
+ metadata.gz: 1909c3b76c9addab63bcc0337232c147ceebde0d1f2252da93606b48d1843c64
4
+ data.tar.gz: 6b405941e4bae0e98abbcc07b93ac1a95fa22bcbdfcaa962d241740a15453ba7
5
5
  SHA512:
6
- metadata.gz: dcc498d22901bfecb649f44b266634ed762d119d0c4d876df04fbe5ae595173e61c3fe53078ea1803000fd5ec6faaa8686e1198aa2037ae6f09b91bf4e20b001
7
- data.tar.gz: 58a8ae501e143744082ca85ac0dba51bdcf5883fa949b25d23fd4c5510c28b877c4f5ca9cbc7f0af5d6d19b7c742fa835fa4b6d7afc1ccaaca0b83c153e9aeb9
6
+ metadata.gz: f5292647cd5c49c51bec7f9f1df33be882637ac83bd54fb23259fc2b5c6d8f351f3501c5db23f0ff7c10daafafed531b4026ff3790ff281cfd71890ff2b2c007
7
+ data.tar.gz: 054adf43e83c54be23fb33547ee521e17ae8f180f5f4c05bf3a7b78f554367e6531483d9bf66af75fe4567940f2931c56f93c2adc6af412efba8e644043af8bc
data/CHANGELOG.md CHANGED
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  * Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
11
11
 
12
+ ## [2.2.0](2022-01-25)
13
+
14
+ * Added: support for subscription type
15
+ * Fixed: correctly detect all graphql-ruby objects when using stringified types
16
+ * Added: make code compatible with newer graphql-ruby version
17
+
12
18
  ## [2.1.0](2022-01-12)
13
19
 
14
20
  * Added: decorated relations now can be called using "find", "empty?" and "find_by" methods
data/Gemfile.lock CHANGED
@@ -1,112 +1,111 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_rails (2.1.0)
4
+ graphql_rails (2.2.0)
5
5
  activesupport (>= 4)
6
6
  graphql (~> 1.12, >= 1.12.4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.0.3.4)
12
- actionpack (= 6.0.3.4)
11
+ actioncable (6.1.4.4)
12
+ actionpack (= 6.1.4.4)
13
+ activesupport (= 6.1.4.4)
13
14
  nio4r (~> 2.0)
14
15
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.3.4)
16
- actionpack (= 6.0.3.4)
17
- activejob (= 6.0.3.4)
18
- activerecord (= 6.0.3.4)
19
- activestorage (= 6.0.3.4)
20
- activesupport (= 6.0.3.4)
16
+ actionmailbox (6.1.4.4)
17
+ actionpack (= 6.1.4.4)
18
+ activejob (= 6.1.4.4)
19
+ activerecord (= 6.1.4.4)
20
+ activestorage (= 6.1.4.4)
21
+ activesupport (= 6.1.4.4)
21
22
  mail (>= 2.7.1)
22
- actionmailer (6.0.3.4)
23
- actionpack (= 6.0.3.4)
24
- actionview (= 6.0.3.4)
25
- activejob (= 6.0.3.4)
23
+ actionmailer (6.1.4.4)
24
+ actionpack (= 6.1.4.4)
25
+ actionview (= 6.1.4.4)
26
+ activejob (= 6.1.4.4)
27
+ activesupport (= 6.1.4.4)
26
28
  mail (~> 2.5, >= 2.5.4)
27
29
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.3.4)
29
- actionview (= 6.0.3.4)
30
- activesupport (= 6.0.3.4)
31
- rack (~> 2.0, >= 2.0.8)
30
+ actionpack (6.1.4.4)
31
+ actionview (= 6.1.4.4)
32
+ activesupport (= 6.1.4.4)
33
+ rack (~> 2.0, >= 2.0.9)
32
34
  rack-test (>= 0.6.3)
33
35
  rails-dom-testing (~> 2.0)
34
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.3.4)
36
- actionpack (= 6.0.3.4)
37
- activerecord (= 6.0.3.4)
38
- activestorage (= 6.0.3.4)
39
- activesupport (= 6.0.3.4)
37
+ actiontext (6.1.4.4)
38
+ actionpack (= 6.1.4.4)
39
+ activerecord (= 6.1.4.4)
40
+ activestorage (= 6.1.4.4)
41
+ activesupport (= 6.1.4.4)
40
42
  nokogiri (>= 1.8.5)
41
- actionview (6.0.3.4)
42
- activesupport (= 6.0.3.4)
43
+ actionview (6.1.4.4)
44
+ activesupport (= 6.1.4.4)
43
45
  builder (~> 3.1)
44
46
  erubi (~> 1.4)
45
47
  rails-dom-testing (~> 2.0)
46
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.3.4)
48
- activesupport (= 6.0.3.4)
49
+ activejob (6.1.4.4)
50
+ activesupport (= 6.1.4.4)
49
51
  globalid (>= 0.3.6)
50
- activemodel (6.0.3.4)
51
- activesupport (= 6.0.3.4)
52
- activerecord (6.0.3.4)
53
- activemodel (= 6.0.3.4)
54
- activesupport (= 6.0.3.4)
55
- activestorage (6.0.3.4)
56
- actionpack (= 6.0.3.4)
57
- activejob (= 6.0.3.4)
58
- activerecord (= 6.0.3.4)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.4)
52
+ activemodel (6.1.4.4)
53
+ activesupport (= 6.1.4.4)
54
+ activerecord (6.1.4.4)
55
+ activemodel (= 6.1.4.4)
56
+ activesupport (= 6.1.4.4)
57
+ activestorage (6.1.4.4)
58
+ actionpack (= 6.1.4.4)
59
+ activejob (= 6.1.4.4)
60
+ activerecord (= 6.1.4.4)
61
+ activesupport (= 6.1.4.4)
62
+ marcel (~> 1.0.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.4.4)
61
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
- i18n (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- zeitwerk (~> 2.2, >= 2.2.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
66
70
  ast (2.4.2)
67
- bson (4.11.0)
71
+ bson (4.14.0)
68
72
  builder (3.2.4)
69
73
  byebug (11.1.3)
70
- codecov (0.2.12)
71
- json
72
- simplecov
74
+ codecov (0.6.0)
75
+ simplecov (>= 0.15, < 0.22)
73
76
  coderay (1.1.3)
74
- concurrent-ruby (1.1.7)
77
+ concurrent-ruby (1.1.9)
75
78
  crass (1.0.6)
76
- diff-lcs (1.4.4)
77
- docile (1.3.2)
78
- erubi (1.9.0)
79
- globalid (0.4.2)
80
- activesupport (>= 4.2.0)
81
- graphql (1.13.4)
82
- i18n (1.8.5)
79
+ diff-lcs (1.5.0)
80
+ docile (1.4.0)
81
+ erubi (1.10.0)
82
+ globalid (1.0.0)
83
+ activesupport (>= 5.0)
84
+ graphql (1.13.6)
85
+ i18n (1.8.11)
83
86
  concurrent-ruby (~> 1.0)
84
- json (2.3.1)
85
- loofah (2.7.0)
87
+ loofah (2.13.0)
86
88
  crass (~> 1.0.2)
87
89
  nokogiri (>= 1.5.9)
88
90
  mail (2.7.1)
89
91
  mini_mime (>= 0.1.1)
90
- marcel (0.3.3)
91
- mimemagic (~> 0.3.2)
92
+ marcel (1.0.2)
92
93
  method_source (1.0.0)
93
- mimemagic (0.3.10)
94
- nokogiri (~> 1)
95
- rake
96
- mini_mime (1.0.2)
97
- mini_portile2 (2.6.1)
98
- minitest (5.14.2)
99
- mongo (2.13.1)
94
+ mini_mime (1.1.2)
95
+ mini_portile2 (2.7.1)
96
+ minitest (5.15.0)
97
+ mongo (2.17.0)
100
98
  bson (>= 4.8.2, < 5.0.0)
101
- mongoid (7.1.4)
102
- activemodel (>= 5.1, < 6.1)
103
- mongo (>= 2.7.0, < 3.0.0)
104
- nio4r (2.5.4)
105
- nokogiri (1.12.5)
106
- mini_portile2 (~> 2.6.1)
99
+ mongoid (7.3.3)
100
+ activemodel (>= 5.1, < 6.2)
101
+ mongo (>= 2.10.5, < 3.0.0)
102
+ ruby2_keywords (~> 0.0.5)
103
+ nio4r (2.5.8)
104
+ nokogiri (1.13.1)
105
+ mini_portile2 (~> 2.7.0)
107
106
  racc (~> 1.4)
108
- parallel (1.20.1)
109
- parser (3.0.1.1)
107
+ parallel (1.21.0)
108
+ parser (3.1.0.0)
110
109
  ast (~> 2.4.1)
111
110
  pry (0.13.1)
112
111
  coderay (~> 1.1)
@@ -114,53 +113,53 @@ GEM
114
113
  pry-byebug (3.9.0)
115
114
  byebug (~> 11.0)
116
115
  pry (~> 0.13.0)
117
- racc (1.5.2)
116
+ racc (1.6.0)
118
117
  rack (2.2.3)
119
118
  rack-test (1.1.0)
120
119
  rack (>= 1.0, < 3)
121
- rails (6.0.3.4)
122
- actioncable (= 6.0.3.4)
123
- actionmailbox (= 6.0.3.4)
124
- actionmailer (= 6.0.3.4)
125
- actionpack (= 6.0.3.4)
126
- actiontext (= 6.0.3.4)
127
- actionview (= 6.0.3.4)
128
- activejob (= 6.0.3.4)
129
- activemodel (= 6.0.3.4)
130
- activerecord (= 6.0.3.4)
131
- activestorage (= 6.0.3.4)
132
- activesupport (= 6.0.3.4)
133
- bundler (>= 1.3.0)
134
- railties (= 6.0.3.4)
120
+ rails (6.1.4.4)
121
+ actioncable (= 6.1.4.4)
122
+ actionmailbox (= 6.1.4.4)
123
+ actionmailer (= 6.1.4.4)
124
+ actionpack (= 6.1.4.4)
125
+ actiontext (= 6.1.4.4)
126
+ actionview (= 6.1.4.4)
127
+ activejob (= 6.1.4.4)
128
+ activemodel (= 6.1.4.4)
129
+ activerecord (= 6.1.4.4)
130
+ activestorage (= 6.1.4.4)
131
+ activesupport (= 6.1.4.4)
132
+ bundler (>= 1.15.0)
133
+ railties (= 6.1.4.4)
135
134
  sprockets-rails (>= 2.0.0)
136
135
  rails-dom-testing (2.0.3)
137
136
  activesupport (>= 4.2.0)
138
137
  nokogiri (>= 1.6)
139
- rails-html-sanitizer (1.3.0)
138
+ rails-html-sanitizer (1.4.2)
140
139
  loofah (~> 2.3)
141
- railties (6.0.3.4)
142
- actionpack (= 6.0.3.4)
143
- activesupport (= 6.0.3.4)
140
+ railties (6.1.4.4)
141
+ actionpack (= 6.1.4.4)
142
+ activesupport (= 6.1.4.4)
144
143
  method_source
145
- rake (>= 0.8.7)
146
- thor (>= 0.20.3, < 2.0)
147
- rainbow (3.0.0)
148
- rake (13.0.1)
149
- regexp_parser (2.1.1)
144
+ rake (>= 0.13)
145
+ thor (~> 1.0)
146
+ rainbow (3.1.1)
147
+ rake (13.0.6)
148
+ regexp_parser (2.2.0)
150
149
  rexml (3.2.5)
151
150
  rspec (3.10.0)
152
151
  rspec-core (~> 3.10.0)
153
152
  rspec-expectations (~> 3.10.0)
154
153
  rspec-mocks (~> 3.10.0)
155
- rspec-core (3.10.0)
154
+ rspec-core (3.10.1)
156
155
  rspec-support (~> 3.10.0)
157
- rspec-expectations (3.10.0)
156
+ rspec-expectations (3.10.2)
158
157
  diff-lcs (>= 1.2.0, < 2.0)
159
158
  rspec-support (~> 3.10.0)
160
- rspec-mocks (3.10.0)
159
+ rspec-mocks (3.10.2)
161
160
  diff-lcs (>= 1.2.0, < 2.0)
162
161
  rspec-support (~> 3.10.0)
163
- rspec-support (3.10.0)
162
+ rspec-support (3.10.3)
164
163
  rubocop (1.5.2)
165
164
  parallel (~> 1.10)
166
165
  parser (>= 2.7.1.5)
@@ -170,35 +169,37 @@ GEM
170
169
  rubocop-ast (>= 1.2.0, < 2.0)
171
170
  ruby-progressbar (~> 1.7)
172
171
  unicode-display_width (>= 1.4.0, < 2.0)
173
- rubocop-ast (1.5.0)
172
+ rubocop-ast (1.15.1)
174
173
  parser (>= 3.0.1.1)
175
- rubocop-performance (1.8.1)
176
- rubocop (>= 0.87.0)
174
+ rubocop-performance (1.10.2)
175
+ rubocop (>= 0.90.0, < 2.0)
177
176
  rubocop-ast (>= 0.4.0)
178
- rubocop-rspec (2.3.0)
177
+ rubocop-rspec (2.4.0)
179
178
  rubocop (~> 1.0)
180
179
  rubocop-ast (>= 1.1.0)
181
180
  ruby-progressbar (1.11.0)
182
- simplecov (0.19.1)
181
+ ruby2_keywords (0.0.5)
182
+ simplecov (0.21.2)
183
183
  docile (~> 1.1)
184
184
  simplecov-html (~> 0.11)
185
+ simplecov_json_formatter (~> 0.1)
185
186
  simplecov-html (0.12.3)
187
+ simplecov_json_formatter (0.1.3)
186
188
  sprockets (4.0.2)
187
189
  concurrent-ruby (~> 1.0)
188
190
  rack (> 1, < 3)
189
- sprockets-rails (3.2.2)
190
- actionpack (>= 4.0)
191
- activesupport (>= 4.0)
191
+ sprockets-rails (3.4.2)
192
+ actionpack (>= 5.2)
193
+ activesupport (>= 5.2)
192
194
  sprockets (>= 3.0.0)
193
- thor (1.0.1)
194
- thread_safe (0.3.6)
195
- tzinfo (1.2.7)
196
- thread_safe (~> 0.1)
197
- unicode-display_width (1.7.0)
198
- websocket-driver (0.7.3)
195
+ thor (1.2.1)
196
+ tzinfo (2.0.4)
197
+ concurrent-ruby (~> 1.0)
198
+ unicode-display_width (1.8.0)
199
+ websocket-driver (0.7.5)
199
200
  websocket-extensions (>= 0.1.0)
200
201
  websocket-extensions (0.1.5)
201
- zeitwerk (2.4.1)
202
+ zeitwerk (2.5.3)
202
203
 
203
204
  PLATFORMS
204
205
  ruby
@@ -73,14 +73,15 @@ end
73
73
 
74
74
  This will generate `userDetails` field on GraphQL side.
75
75
 
76
- ## _query_ and _mutation_
76
+ ## _query_ and _mutation_ & _subscription_
77
77
 
78
- in case you want to have non-CRUD controller with custom actions you can define your own `query`/`mutation` actions like this:
78
+ in case you want to have non-CRUD controller with custom actions you can define your own `query`/`mutation`/`subscription` actions like this:
79
79
 
80
80
  ```ruby
81
81
  MyGraphqlSchema = GraphqlRails::Router.draw do
82
82
  mutation :logIn, to: 'sessions#login'
83
- query :me, to 'users#current_user'
83
+ query :me, to: 'users#current_user'
84
+ subscribtion :new_message, to: 'messages#created'
84
85
  end
85
86
  ```
86
87
 
@@ -52,12 +52,6 @@ module GraphqlRails
52
52
  GraphQL::InputObjectType
53
53
  ].freeze
54
54
 
55
- PARSEABLE_RAW_GRAPHQL_TYPES = [
56
- GraphQL::Schema::Object,
57
- GraphQL::Schema::Scalar,
58
- GraphQL::Schema::Enum
59
- ].freeze
60
-
61
55
  RAW_GRAPHQL_TYPES = (WRAPPER_TYPES + GRAPHQL_BASE_TYPES).freeze
62
56
 
63
57
  def unwrapped_scalar_type
@@ -103,7 +97,7 @@ module GraphqlRails
103
97
  def graphql_type_object?(type_class)
104
98
  return false unless type_class.is_a?(Class)
105
99
 
106
- PARSEABLE_RAW_GRAPHQL_TYPES.any? { |parent_type| type_class < parent_type }
100
+ type_class < GraphQL::Schema::Member
107
101
  end
108
102
 
109
103
  def applicable_graphql_type?(type)
@@ -62,9 +62,14 @@ module GraphqlRails
62
62
  end
63
63
 
64
64
  def parameter_filter_class
65
- return ActiveSupport::ParameterFilter if Object.const_defined?('ActiveSupport::ParameterFilter')
65
+ if ActiveSupport.gem_version.segments.first < 6
66
+ return ActiveSupport::ParameterFilter if Object.const_defined?('ActiveSupport::ParameterFilter')
66
67
 
67
- ActionDispatch::Http::ParameterFilter
68
+ ActionDispatch::Http::ParameterFilter
69
+ else
70
+ require 'active_support/parameter_filter'
71
+ ActiveSupport::ParameterFilter
72
+ end
68
73
  end
69
74
  end
70
75
  end
@@ -26,7 +26,7 @@ module GraphqlRails
26
26
  pagination_options = nil if pagination_options == false
27
27
 
28
28
  @pagination_options = pagination_options
29
- permit(:before, :after, first: :int, last: :int)
29
+ self
30
30
  end
31
31
 
32
32
  def paginated?
@@ -46,11 +46,7 @@ module GraphqlRails
46
46
 
47
47
  def find_or_build_dynamic_type(attribute)
48
48
  graphql_model = attribute.graphql_model
49
- if graphql_model
50
- find_or_build_graphql_model_type(graphql_model)
51
- else
52
- AddFieldsToGraphqlType.call(klass: klass, attributes: [attribute])
53
- end
49
+ find_or_build_graphql_model_type(graphql_model) if graphql_model
54
50
  end
55
51
 
56
52
  def find_or_build_graphql_model_type(graphql_model)
@@ -13,6 +13,10 @@ module GraphqlRails
13
13
  def mutation?
14
14
  true
15
15
  end
16
+
17
+ def subscription?
18
+ false
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -13,6 +13,10 @@ module GraphqlRails
13
13
  def mutation?
14
14
  false
15
15
  end
16
+
17
+ def subscription?
18
+ false
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -28,6 +28,10 @@ module GraphqlRails
28
28
  routes << build_mutation(*args, **kwargs)
29
29
  end
30
30
 
31
+ def subscription(*args, **kwargs)
32
+ routes << build_subscription(*args, **kwargs)
33
+ end
34
+
31
35
  private
32
36
 
33
37
  attr_reader :autogenerated_action_names, :name, :options
@@ -62,6 +66,10 @@ module GraphqlRails
62
66
  build_route(QueryRoute, *args, **kwargs)
63
67
  end
64
68
 
69
+ def build_subscription(*args, **kwargs)
70
+ build_route(SubscriptionRoute, *args, **kwargs)
71
+ end
72
+
65
73
  # rubocop:disable Metrics/ParameterLists
66
74
  def build_route(builder, action, prefix: action, suffix: false, on: :member, **custom_options)
67
75
  if suffix == true
@@ -6,11 +6,12 @@ module GraphqlRails
6
6
  class SchemaBuilder
7
7
  require_relative './plain_cursor_encoder'
8
8
 
9
- attr_reader :queries, :mutations, :raw_actions
9
+ attr_reader :queries, :mutations, :subscriptions, :raw_actions
10
10
 
11
- def initialize(queries:, mutations:, raw_actions:, group: nil)
11
+ def initialize(queries:, mutations:, subscriptions:, raw_actions:, group: nil)
12
12
  @queries = queries
13
13
  @mutations = mutations
14
+ @subscriptions = subscriptions
14
15
  @raw_actions = raw_actions
15
16
  @group = group
16
17
  end
@@ -18,6 +19,7 @@ module GraphqlRails
18
19
  def call
19
20
  query_type = build_group_type('Query', queries)
20
21
  mutation_type = build_group_type('Mutation', mutations)
22
+ subscription_type = build_group_type('Subscription', subscriptions)
21
23
  raw = raw_actions
22
24
 
23
25
  Class.new(GraphQL::Schema) do
@@ -30,6 +32,7 @@ module GraphqlRails
30
32
 
31
33
  query(query_type) if query_type
32
34
  mutation(mutation_type) if mutation_type
35
+ subscription(subscription_type) if subscription_type
33
36
  end
34
37
  end
35
38
 
@@ -39,7 +42,13 @@ module GraphqlRails
39
42
 
40
43
  def build_group_type(type_name, routes)
41
44
  group_name = group
42
- group_routes = routes.select { |route| route.show_in_group?(group_name) }
45
+ group_routes =
46
+ routes
47
+ .select { |route| route.show_in_group?(group_name) }
48
+ .reverse
49
+ .uniq(&:name)
50
+ .reverse
51
+
43
52
  return if group_routes.empty?
44
53
 
45
54
  build_type(type_name, group_routes)
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'route'
4
+
5
+ module GraphqlRails
6
+ class Router
7
+ # stores subscription type graphql action info
8
+ class SubscriptionRoute < Route
9
+ def query?
10
+ false
11
+ end
12
+
13
+ def mutation?
14
+ false
15
+ end
16
+
17
+ def subscription?
18
+ true
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,6 +5,7 @@ require 'active_support/core_ext/string/inflections'
5
5
  require 'graphql_rails/router/schema_builder'
6
6
  require 'graphql_rails/router/mutation_route'
7
7
  require 'graphql_rails/router/query_route'
8
+ require 'graphql_rails/router/subscription_route'
8
9
  require 'graphql_rails/router/resource_routes_builder'
9
10
 
10
11
  module GraphqlRails
@@ -27,6 +28,7 @@ module GraphqlRails
27
28
  @group_names = group_names
28
29
  @routes ||= Set.new
29
30
  @raw_graphql_actions ||= []
31
+ @graphql_schema = {}
30
32
  end
31
33
 
32
34
  def group(*group_names, &block)
@@ -57,6 +59,10 @@ module GraphqlRails
57
59
  routes << build_route(MutationRoute, name, **options)
58
60
  end
59
61
 
62
+ def subscription(name, **options)
63
+ routes << build_route(SubscriptionRoute, name, **options)
64
+ end
65
+
60
66
  RAW_ACTION_NAMES.each do |action_name|
61
67
  define_method(action_name) do |*args, &block|
62
68
  add_raw_action(action_name, *args, &block)
@@ -64,17 +70,17 @@ module GraphqlRails
64
70
  end
65
71
 
66
72
  def graphql_schema(group = nil)
67
- @graphql_schema ||= {}
68
73
  @graphql_schema[group&.to_sym] ||= SchemaBuilder.new(
69
74
  queries: routes.select(&:query?),
70
75
  mutations: routes.select(&:mutation?),
76
+ subscriptions: routes.select(&:subscription?),
71
77
  raw_actions: raw_graphql_actions,
72
78
  group: group
73
79
  ).call
74
80
  end
75
81
 
76
82
  def reload_schema
77
- @graphql_schema = nil
83
+ @graphql_schema.clear
78
84
  end
79
85
 
80
86
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlRails
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurčys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -226,6 +226,7 @@ files:
226
226
  - lib/graphql_rails/router/resource_routes_builder.rb
227
227
  - lib/graphql_rails/router/route.rb
228
228
  - lib/graphql_rails/router/schema_builder.rb
229
+ - lib/graphql_rails/router/subscription_route.rb
229
230
  - lib/graphql_rails/rspec_controller_helpers.rb
230
231
  - lib/graphql_rails/tasks/dump_graphql_schema.rb
231
232
  - lib/graphql_rails/tasks/dump_graphql_schemas.rb