graphiti 1.3.0 → 1.3.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
  SHA256:
3
- metadata.gz: c694cce2123c7ba03ae53b53b61b9aaa5c353681e28a93722bc73569845ea2e2
4
- data.tar.gz: 2305bdf6566d1bcba126dbe893dd64f6f011367151e0a283185fba62781d0d02
3
+ metadata.gz: 6a4d4d39d07565c8576f7294c334b391b69a6c4c20710b7901b189eab967b60b
4
+ data.tar.gz: 2f63bf884fb57ff25e748f656651c61b9c93e8175719f5e0757a49f5fbd55752
5
5
  SHA512:
6
- metadata.gz: 3d9d20b0b87720079461b0ce245970da308362616cb4c21c4232fb85c585a62694f3bdb874db3cf8d80e94e02ff3078c119e0a0a46e95dbdb94e439dbf5a1af8
7
- data.tar.gz: 9cf83060d95a7789351f3f0979ccf46012238975248159d8a5fccd0e457b512cfc127b3a4295c46f668b80717dfec2152fea025d00a82a1ffcdd42edde9e5c7f
6
+ metadata.gz: 87becc989b7082cbbf6464396f68249effddf376a2a1380cea9e1575e30213d15b4b370e9bea33a0ad42ddbd9fcdae038a1032940a4d0a66ac4783450c43c865
7
+ data.tar.gz: ed7c25d26c72f1abbe709ca49959ce9f6e6277b190cabcb8028faf65b736da5a94955818a5e0a2f28e572fee4d8ac5b6df17c19f2694d482b1cff7d6f035fa7c
data/CHANGELOG.md CHANGED
@@ -12,6 +12,7 @@ Features:
12
12
  Fixes:
13
13
  - [282] Support model names including "Resource"
14
14
  - [313](https://github.com/graphiti-api/graphiti/pull/313) Sort remote resources in schema generation
15
+ - [374](https://github.com/graphiti-api/graphiti/pull/374) Trim leading spaces from error messages
15
16
 
16
17
  ## 1.1.0
17
18
 
@@ -24,7 +24,9 @@ module Graphiti
24
24
  end
25
25
 
26
26
  def has_previous_page?
27
- current_page != 1
27
+ current_page != 1 ||
28
+ !!pagination_params.try(:[], :page).try(:[], :after) ||
29
+ !!pagination_params.try(:[], :page).try(:[], :offset)
28
30
  end
29
31
 
30
32
  private
@@ -35,7 +35,7 @@ module Graphiti
35
35
  end
36
36
 
37
37
  def message
38
- <<-MSG
38
+ <<~MSG
39
39
  The adapter #{@adapter.class} does not implement method '#{@method}', which was requested for attribute '#{@attribute}'. Add this method to your adapter to support this filter operator.
40
40
  MSG
41
41
  end
@@ -49,7 +49,7 @@ module Graphiti
49
49
  end
50
50
 
51
51
  def message
52
- <<-MSG
52
+ <<~MSG
53
53
  #{@parent_resource_class} sideload :#{@name} - #{@message}
54
54
  MSG
55
55
  end
@@ -78,7 +78,7 @@ module Graphiti
78
78
  end
79
79
 
80
80
  def message
81
- <<-MSG
81
+ <<~MSG
82
82
  #{@resource_class}: Tried to pass block to .#{@method_name}, which only accepts a method name.
83
83
  MSG
84
84
  end
@@ -90,7 +90,7 @@ module Graphiti
90
90
  end
91
91
 
92
92
  def message
93
- <<-MSG
93
+ <<~MSG
94
94
  #{@resource_class}: Tried to perform write operation. Writes are not supported for remote resources - hit the endpoint directly.
95
95
  MSG
96
96
  end
@@ -105,7 +105,7 @@ module Graphiti
105
105
  end
106
106
 
107
107
  def message
108
- <<-MSG
108
+ <<~MSG
109
109
  #{@resource.class}: Tried to filter #{@filter_name.inspect} on operator #{@operator.inspect}, but not supported! Supported operators are #{@supported}.
110
110
  MSG
111
111
  end
@@ -118,7 +118,7 @@ module Graphiti
118
118
  end
119
119
 
120
120
  def message
121
- <<-MSG
121
+ <<~MSG
122
122
  #{@sideload.parent_resource.class.name}: tried to sideload #{@sideload.name.inspect}, but more than one #{@sideload.parent_resource.model.name} was passed!
123
123
 
124
124
  This is because you marked the sideload #{@sideload.name.inspect} with single: true
@@ -139,7 +139,7 @@ module Graphiti
139
139
  end
140
140
 
141
141
  def message
142
- <<-MSG
142
+ <<~MSG
143
143
  #{@resource.class.name}: tried to sort on attribute #{@attribute.inspect}, but passed #{@direction.inspect} when only #{@allowlist.inspect} is supported.
144
144
  MSG
145
145
  end
@@ -152,7 +152,7 @@ module Graphiti
152
152
  end
153
153
 
154
154
  def message
155
- <<-MSG
155
+ <<~MSG
156
156
  #{@resource_class.name}: called .on_extra_attribute #{@name.inspect}, but extra attribute #{@name.inspect} does not exist!
157
157
  MSG
158
158
  end
@@ -173,7 +173,7 @@ module Graphiti
173
173
  else
174
174
  "value #{@value.inspect}"
175
175
  end
176
- msg = <<-MSG
176
+ msg = <<~MSG
177
177
  #{@resource.class.name}: tried to filter on #{@filter.keys[0].inspect}, but passed invalid #{value_string}.
178
178
  MSG
179
179
  msg << "\nAllowlist: #{allow.inspect}" if allow
@@ -190,7 +190,7 @@ module Graphiti
190
190
  end
191
191
 
192
192
  def message
193
- <<-MSG
193
+ <<~MSG
194
194
  #{@resource_class.name} You declared an attribute or filter of type "#{@enum_type}" without providing a list of permitted values, which is required.
195
195
 
196
196
  When declaring an attribute:
@@ -214,7 +214,7 @@ module Graphiti
214
214
  end
215
215
 
216
216
  def message
217
- <<-MSG
217
+ <<~MSG
218
218
  #{@resource_class.name}: Cannot link to sideload #{@sideload.name.inspect}!
219
219
 
220
220
  Make sure the endpoint "#{@sideload.resource.endpoint[:full_path]}" exists with action #{@action.inspect}, or customize the endpoint for #{@sideload.resource.class.name}.
@@ -215,11 +215,11 @@ module Graphiti
215
215
  end
216
216
 
217
217
  if fields.include?(:start_cursor)
218
- info[:startCursor] = serializers.first.cursor
218
+ info[:startCursor] = serializers.first.try(:cursor)
219
219
  end
220
220
 
221
221
  if fields.include?(:end_cursor)
222
- info[:endCursor] = serializers.last.cursor
222
+ info[:endCursor] = serializers.last.try(:cursor)
223
223
  end
224
224
 
225
225
  hash[top_level_key][:pageInfo] = info
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-08 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable
@@ -361,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
361
  - !ruby/object:Gem::Version
362
362
  version: '0'
363
363
  requirements: []
364
- rubygems_version: 3.1.4
364
+ rubygems_version: 3.2.22
365
365
  signing_key:
366
366
  specification_version: 4
367
367
  summary: Easily build jsonapi.org-compatible APIs