graphiti 1.13.1 → 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: '00079e4b8294e1599af72b809255cd45241c9ce730b52da2bd2cb0f43ca1896d'
4
- data.tar.gz: bd94a8f30ac9c6ba15faee254c86399d08b43ff0c7583b667100a6d07a3f6428
3
+ metadata.gz: f75003b9d958879d44777f39f94e8221224b3826d80a8fe6e420e510ea4dd163
4
+ data.tar.gz: 0d0dda07deaefcc5fdfc7c91f44b3b7677b82ed950770ddb08cf24d49ea5e10e
5
5
  SHA512:
6
- metadata.gz: 9691a12e9e2f38d3f3efa1988166d8d721fbda285a4a5b66e9bd532817029d745a4787cd6b62260e800a8de213b86ed4ac0ddf67e92bfa0db4fa22fa6c25d402
7
- data.tar.gz: fb40fdeb2791635ec48d512a0eeae788bfaf6472c8f9de23894d166610c702acb3bad6728b69647b4934ab2bb2ac814ac1dd767d4aaccb240e6d5981c18414bc
6
+ metadata.gz: 57117fb28dc6f0434c91b57e8b7960caeb5bdb33d2d2768009138ec66f10d7d057c472c696e07debeb4af149e5de4ddfcffb30741b473810d4b589a7ac4adc8e
7
+ data.tar.gz: 394c4e38acfc68b78c966ecf3cb7dbd73a5038a5163c8c72045e185eb02a9ed4f919c20ee2598b015cfc27f04b749d1fc7f5b306856befd13d006cb81d0a73af
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
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
+
11
+ ## [1.13.2](https://github.com/graphiti-api/graphiti/compare/v1.13.1...v1.13.2) (2026-08-07)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * drop the relationship guard install notice ([65b8be6](https://github.com/graphiti-api/graphiti/commit/65b8be65455a7d034c9dca082434c1dbfe610a7a))
17
+
3
18
  ## [1.13.1](https://github.com/graphiti-api/graphiti/compare/v1.13.0...v1.13.1) (2026-08-02)
4
19
 
5
20
 
data/graphiti.gemspec CHANGED
@@ -18,24 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
  spec.required_ruby_version = ">= 2.7"
20
20
 
21
- # TODO: remove once the 1.12 upgrade window has passed
22
- spec.post_install_message = <<~MSG
23
- Graphiti: relationship readable:/writable: guards are now enforced.
24
-
25
- Symbols, strings, and procs passed to a relationship's readable/writable
26
- guards were always interpreted as true and never actually called before this
27
- conditional relationship change. They are now evaluated per-request, where
28
- unreadable relationships are omitted from responses and includes, and unwritable
29
- relationships reject writes.
30
-
31
- To list every affected relationship in your app:
32
-
33
- bin/rails runner 'puts Graphiti.guarded_relationships'
34
-
35
- Audit these before deploying. Apps using schema.json will also see affected
36
- relationships flagged as "became guarded" by the schema check.
37
- MSG
38
-
39
21
  spec.add_dependency "jsonapi-serializable", "~> 0.3.0"
40
22
  spec.add_dependency "jsonapi-renderer", "~> 0.2", ">= 0.2.2"
41
23
  spec.add_dependency "dry-types", ">= 0.15.0", "< 2.0"
@@ -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.1"
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.1
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-02 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
@@ -371,14 +371,7 @@ homepage: https://github.com/graphiti-api/graphiti
371
371
  licenses:
372
372
  - MIT
373
373
  metadata: {}
374
- post_install_message: "Graphiti: relationship readable:/writable: guards are now enforced.\n\nSymbols,
375
- strings, and procs passed to a relationship's readable/writable\nguards were always
376
- interpreted as true and never actually called before this\nconditional relationship
377
- change. They are now evaluated per-request, where\nunreadable relationships are
378
- omitted from responses and includes, and unwritable\nrelationships reject writes.\n\nTo
379
- list every affected relationship in your app:\n\n bin/rails runner 'puts Graphiti.guarded_relationships'\n\nAudit
380
- these before deploying. Apps using schema.json will also see affected \nrelationships
381
- flagged as \"became guarded\" by the schema check.\n"
374
+ post_install_message:
382
375
  rdoc_options: []
383
376
  require_paths:
384
377
  - lib