graphiti 1.13.2 → 1.13.3

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: ffedb3e23185f2ec27cb3aebb302c7e27caad8d9595605a90dc1de87d08a5f93
4
- data.tar.gz: '082375ee5cb6e20e0b1dc1bbc80cb4283e0c6f7330e4bbc02d253aa074bbfeef'
3
+ metadata.gz: f75003b9d958879d44777f39f94e8221224b3826d80a8fe6e420e510ea4dd163
4
+ data.tar.gz: 0d0dda07deaefcc5fdfc7c91f44b3b7677b82ed950770ddb08cf24d49ea5e10e
5
5
  SHA512:
6
- metadata.gz: 7b7af8affb728561eef3e45a83f238597465eb8d050a44ec41bfe84e88de2455b86f998d3141a345bec100b41ca479c057643a1db86bbd8c57cac101d629b45c
7
- data.tar.gz: 5eecece4715d3bab183ec10e37a846558ab547534b03bf15f601ea576735a3952717a567d25fa6c3746317c5449a99a5477e5758c22142f5d4e820d155bd4211
6
+ metadata.gz: 57117fb28dc6f0434c91b57e8b7960caeb5bdb33d2d2768009138ec66f10d7d057c472c696e07debeb4af149e5de4ddfcffb30741b473810d4b589a7ac4adc8e
7
+ data.tar.gz: 394c4e38acfc68b78c966ecf3cb7dbd73a5038a5163c8c72045e185eb02a9ed4f919c20ee2598b015cfc27f04b749d1fc7f5b306856befd13d006cb81d0a73af
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  graphiti changelog
2
2
 
3
+ ## [1.13.3](https://github.com/graphiti-api/graphiti/compare/v1.13.2...v1.13.3) (2026-08-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * reject invalid page parameters ([#537](https://github.com/graphiti-api/graphiti/issues/537)) ([fbb5683](https://github.com/graphiti-api/graphiti/commit/fbb5683393301e17ffcea84990ac5a95bdd3e15f)), closes [#347](https://github.com/graphiti-api/graphiti/issues/347)
9
+ * treat empty polymorphic configuration as unset ([#538](https://github.com/graphiti-api/graphiti/issues/538)) ([a27eeea](https://github.com/graphiti-api/graphiti/commit/a27eeea6eeb72749376c1f7959cadc89012142b9)), closes [#199](https://github.com/graphiti-api/graphiti/issues/199)
10
+
3
11
  ## [1.13.2](https://github.com/graphiti-api/graphiti/compare/v1.13.1...v1.13.2) (2026-08-07)
4
12
 
5
13
 
@@ -11,10 +11,12 @@ module Graphiti
11
11
  end
12
12
 
13
13
  def validate
14
+ validate_page
15
+
14
16
  # Right now, all requests - even reads - go through the validator
15
17
  # In the future these should have their own validation logic, but
16
18
  # for now we can just bypass
17
- return true unless @params.has_key?(:data)
19
+ return errors.blank? unless @params.has_key?(:data)
18
20
 
19
21
  resource = @root_resource
20
22
 
@@ -48,6 +50,13 @@ module Graphiti
48
50
 
49
51
  private
50
52
 
53
+ def validate_page
54
+ page = @params[:page]
55
+ return if page.nil? || page.respond_to?(:each_pair)
56
+
57
+ @errors.add(:page, :invalid, message: "must be an object")
58
+ end
59
+
51
60
  def process_relationships(resource, relationships, payload_path)
52
61
  relationships.each_key do |name|
53
62
  unless resource.class.sideload(name.to_sym)
@@ -21,6 +21,10 @@ module Graphiti
21
21
  send(:prepend, Polymorphism)
22
22
  end
23
23
 
24
+ def polymorphic?
25
+ polymorphic.present?
26
+ end
27
+
24
28
  def type=(val)
25
29
  val = val&.to_sym
26
30
  if (val = super)
@@ -8,6 +8,8 @@ module Graphiti
8
8
  end
9
9
 
10
10
  def serializer_for(model)
11
+ return super unless self.class.polymorphic?
12
+
11
13
  if polymorphic_child?
12
14
  serializer
13
15
  else
@@ -17,10 +19,14 @@ module Graphiti
17
19
  end
18
20
 
19
21
  def associate_all(*args)
22
+ return super unless self.class.polymorphic?
23
+
20
24
  _associate(:associate_all, *args)
21
25
  end
22
26
 
23
27
  def associate(*args)
28
+ return super unless self.class.polymorphic?
29
+
24
30
  _associate(:associate, *args)
25
31
  end
26
32
 
@@ -34,6 +40,8 @@ module Graphiti
34
40
 
35
41
  module ClassMethods
36
42
  def inherited(klass)
43
+ return super unless polymorphic?
44
+
37
45
  klass.type = nil
38
46
  klass.model = klass.infer_model
39
47
  klass.endpoint = klass.infer_endpoint
@@ -42,6 +50,8 @@ module Graphiti
42
50
  end
43
51
 
44
52
  def sideload(name)
53
+ return super unless polymorphic?
54
+
45
55
  if (split_on = name.to_s.split(/^on__/)).length > 1
46
56
  on_type, name = split_on[1].split("--").map(&:to_sym)
47
57
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.13.2"
2
+ VERSION = "1.13.3"
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.13.2
4
+ version: 1.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-07 00:00:00.000000000 Z
11
+ date: 2026-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable