graphiti 1.2.36 → 1.2.37

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: 2b7630aef39d3ce4584f53710a5cbe8617addc0a0ea042077c41562accb1c5cf
4
- data.tar.gz: aad06cd10d1f2604432303990cf92d7b885333d15ccd733a5d0bbab062346872
3
+ metadata.gz: 1ae9a52df4d54256b453573dc02f8eb2d8b1ad062eec7b38be89e3fbc7c6a9f3
4
+ data.tar.gz: 99ce6f9e0067eae81661338a933561b2c573b8a78bd92551d6ef5b21a16e6cdf
5
5
  SHA512:
6
- metadata.gz: 063c97d7d4c719c1cbff7a8028b54a0d862e763bda69a8bae12cbe4a2d5201183b6d516936e9339faf3d35307a1375cf28859253e5fd3c6d1b5824b306fe0d2a
7
- data.tar.gz: 07dc6893d86bbdfbe676b15707edae40601159d1bb7239b58004280e3c9e5d29c313a9bcc525a2fe7e9582f6191972b8095c0d4a5873a72f15cb5589c9879841
6
+ metadata.gz: d77c8c268ef6c44b0557cf50fd3ecdfc71013fd25545cac6a935afd48f7e40caf47045af60649e03bf4f5ee01d8269d05f6be5991bc26a3c6303b7eb2d537afb
7
+ data.tar.gz: e83bf82263f8b59b2e10a243238c85204631f0eca55ed3306d07129f30d099421d4b518c841bf460187329760d0f9920ff90f5136797cfa1ed13d5cf18d90b3d
@@ -1,8 +1,8 @@
1
1
  module Graphiti
2
2
  class SchemaDiff
3
3
  def initialize(old, new)
4
- @old = old.deep_symbolize_keys
5
- @new = new.deep_symbolize_keys
4
+ @old = JSON.parse(old.to_json).deep_symbolize_keys
5
+ @new = JSON.parse(new.to_json).deep_symbolize_keys
6
6
  @errors = []
7
7
  end
8
8
 
@@ -135,12 +135,12 @@ module Graphiti
135
135
  end
136
136
 
137
137
  if new_sort[:only] && !old_sort[:only]
138
- @errors << "#{old_resource[:name]}: sort #{name.inspect} now limited to only #{new_sort[:only].inspect}."
138
+ @errors << "#{old_resource[:name]}: sort #{name.inspect} now limited to only #{new_sort[:only].to_sym.inspect}."
139
139
  end
140
140
 
141
141
  if new_sort[:only] && old_sort[:only]
142
142
  if new_sort[:only] != old_sort[:only]
143
- @errors << "#{old_resource[:name]}: sort #{name.inspect} was limited to only #{old_sort[:only].inspect}, now limited to only #{new_sort[:only].inspect}."
143
+ @errors << "#{old_resource[:name]}: sort #{name.inspect} was limited to only #{old_sort[:only].to_sym.inspect}, now limited to only #{new_sort[:only].to_sym.inspect}."
144
144
  end
145
145
  end
146
146
  end
@@ -212,28 +212,30 @@ module Graphiti
212
212
  new_names = new_resource[:filter_group][:names]
213
213
  old_names = old_resource[:filter_group][:names]
214
214
  diff = new_names - old_names
215
- if !diff.empty? && new_resource[:filter_group][:required] == :all
216
- @errors << "#{old_resource[:name]}: all required filter group #{old_names.inspect} added #{"member".pluralize(diff.length)} #{diff.inspect}."
215
+ if !diff.empty? && new_resource[:filter_group][:required] == "all"
216
+ @errors << "#{old_resource[:name]}: all required filter group #{old_names.map(&:to_sym).inspect} added #{"member".pluralize(diff.length)} #{diff.map(&:to_sym).inspect}."
217
217
  end
218
218
 
219
219
  old_required = old_resource[:filter_group][:required]
220
220
  new_required = new_resource[:filter_group][:required]
221
- if old_required == :any && new_required == :all
222
- @errors << "#{old_resource[:name]}: filter group #{old_names.inspect} moved from required: :any to required: :all"
221
+ if old_required == "any" && new_required == "all"
222
+ @errors << "#{old_resource[:name]}: filter group #{old_names.map(&:to_sym).inspect} moved from required: :any to required: :all"
223
223
  end
224
224
  else
225
- @errors << "#{old_resource[:name]}: filter group #{new_resource[:filter_group][:names].inspect} was added."
225
+ @errors << "#{old_resource[:name]}: filter group #{new_resource[:filter_group][:names].map(&:to_sym).inspect} was added."
226
226
  end
227
227
  end
228
228
  end
229
229
 
230
230
  def compare_stats(old_resource, new_resource)
231
+ return unless old_resource.key?(:stats)
232
+
231
233
  old_resource[:stats].each_pair do |name, old_calculations|
232
234
  new_calculations = new_resource[:stats][name]
233
235
  if new_calculations
234
236
  old_calculations.each do |calc|
235
237
  unless new_calculations.include?(calc)
236
- @errors << "#{old_resource[:name]}: calculation #{calc.inspect} was removed from stat #{name.inspect}."
238
+ @errors << "#{old_resource[:name]}: calculation #{calc.to_sym.inspect} was removed from stat #{name.inspect}."
237
239
  end
238
240
  end
239
241
  else
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.2.36"
2
+ VERSION = "1.2.37"
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.2.36
4
+ version: 1.2.37
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-03-19 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable