Skip to content

Commit

Permalink
Merge branch 'master' into field_condition_blocks_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeen committed Nov 11, 2024
2 parents 0d9a217 + 7ce9cdb commit 4dcdb1a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
graphiti changelog

## [1.7.6](https://github.com/graphiti-api/graphiti/compare/v1.7.5...v1.7.6) (2024-11-06)


### Bug Fixes

* Gem version check ([#483](https://github.com/graphiti-api/graphiti/issues/483)) ([68e2492](https://github.com/graphiti-api/graphiti/commit/68e2492032692d8bb928a733f8b0f8710be31c49))

## [1.7.5](https://github.com/graphiti-api/graphiti/compare/v1.7.4...v1.7.5) (2024-09-16)


Expand Down
2 changes: 1 addition & 1 deletion lib/graphiti/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def destroy(model_instance)
end

def close
if ::ActiveRecord.version > "7.2"
if ::ActiveRecord.version > Gem::Version.new("7.2")
::ActiveRecord::Base.connection_handler.clear_active_connections!
else
::ActiveRecord::Base.clear_active_connections!
Expand Down
3 changes: 1 addition & 2 deletions lib/graphiti/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class Serializer < JSONAPI::Serializable::Resource
class_attribute :attributes_applied_via_resource
class_attribute :extra_attributes_applied_via_resource
class_attribute :relationship_condition_blocks
class_attribute :field_condition_blocks
self.field_condition_blocks ||= {}

self.attributes_applied_via_resource = []
self.extra_attributes_applied_via_resource = []
# See #requested_relationships
Expand Down
2 changes: 1 addition & 1 deletion lib/graphiti/util/serializer_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def previously_applied_via_resource?
end

def previously_guarded?
@serializer.field_condition_blocks[@name]
@serializer.respond_to?(:field_condition_blocks) && @serializer.field_condition_blocks[@name]
end

def remove_guard
Expand Down
24 changes: 18 additions & 6 deletions spec/schema_diff_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,15 @@ def self.name
end

it "returns error" do
expect(diff).to eq([
'SchemaDiff::EmployeeResource: default sort changed from [{:foo=>"asc"}] to [{:foo=>"desc"}].'
])
if RUBY_VERSION >= "3.4"
expect(diff).to eq([
'SchemaDiff::EmployeeResource: default sort changed from [{foo: "asc"}] to [{foo: "desc"}].'
])
else
expect(diff).to eq([
'SchemaDiff::EmployeeResource: default sort changed from [{:foo=>"asc"}] to [{:foo=>"desc"}].'
])
end
end
end

Expand Down Expand Up @@ -1204,9 +1210,15 @@ def self.name
end

it "returns error" do
expect(diff).to eq([
'Endpoint "/schema_diff/employees" had incompatible sideload allowlist. Was [{:positions=>"department"}, "same"], now ["positions", "same"].'
])
if RUBY_VERSION >= "3.4"
expect(diff).to eq([
'Endpoint "/schema_diff/employees" had incompatible sideload allowlist. Was [{positions: "department"}, "same"], now ["positions", "same"].'
])
else
expect(diff).to eq([
'Endpoint "/schema_diff/employees" had incompatible sideload allowlist. Was [{:positions=>"department"}, "same"], now ["positions", "same"].'
])
end
end
end
end
Expand Down

0 comments on commit 4dcdb1a

Please sign in to comment.