Skip to content

fix: treat empty polymorphic configuration as unset - #538

Merged
jkeen merged 2 commits into
graphiti-api:mainfrom
alloutflo:codex/issue-199-empty-polymorphic
Aug 9, 2026
Merged

fix: treat empty polymorphic configuration as unset#538
jkeen merged 2 commits into
graphiti-api:mainfrom
alloutflo:codex/issue-199-empty-polymorphic

Conversation

@alloutflo

@alloutflo alloutflo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make an empty polymorphic collection report as non-polymorphic
  • delegate already-prepended polymorphism hooks to normal resource behavior when the collection becomes empty
  • preserve the unknown-child regression with a genuinely partial child list

This also handles the case raised in the issue discussion where a previously populated collection later becomes empty: the behavior checks the current collection rather than relying only on assignment time.

Fixes #199

Validation

  • bundle exec rspec spec/polymorphism_spec.rb — 18 examples, 0 failures
  • bundle exec rspec — 1,421 examples, 0 failures, 21 pending
  • bundle exec standardrb — passed

@alloutflo
alloutflo marked this pull request as ready for review August 9, 2026 13:13
@jkeen
jkeen merged commit a27eeea into graphiti-api:main Aug 9, 2026
51 checks passed
jkeen pushed a commit that referenced this pull request Aug 9, 2026
@jkeen

jkeen commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks @alloutflo!

github-actions Bot pushed a commit that referenced this pull request Aug 9, 2026
## [1.13.3](v1.13.2...v1.13.3) (2026-08-09)

### Bug Fixes

* reject invalid page parameters ([#537](#537)) ([fbb5683](fbb5683)), closes [#347](#347)
* treat empty polymorphic configuration as unset ([#538](#538)) ([a27eeea](a27eeea)), closes [#199](#199)
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.13.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions Bot pushed a commit that referenced this pull request Aug 9, 2026
# [2.0.0-beta.6](v2.0.0-beta.5...v2.0.0-beta.6) (2026-08-09)

### Bug Fixes

* reject invalid page parameters ([#537](#537)) ([bb3698b](bb3698b)), closes [#347](#347)
* treat empty polymorphic configuration as unset ([#538](#538)) ([5c17899](5c17899)), closes [#199](#199)

### Features

* Add graphiti:audit task to audit resources for issues ([84436ea](84436ea))
* raise MissingRelationshipMethod when rendering reads an association the model does not define ([1c41cee](1c41cee))
* rename always_include_resource_ids to resource_ids, with a belongs_to_resource_ids_by_default setting ([8b11151](8b11151))
github-actions Bot pushed a commit that referenced this pull request Aug 10, 2026
# [2.0.0-beta.8](v2.0.0-beta.7...v2.0.0-beta.8) (2026-08-10)

### Bug Fixes

* accept a single value for array filters ([#517](#517)) ([ee685b6](ee685b6))
* accept a single value for array filters ([#517](#517)) ([23f3e80](23f3e80))
* drop the relationship guard install notice ([65b8be6](65b8be6))
* reject invalid page parameters ([#537](#537)) ([fbb5683](fbb5683)), closes [#347](#347)
* treat empty polymorphic configuration as unset ([#538](#538)) ([a27eeea](a27eeea)), closes [#199](#199)
* typecast null values in filter lists ([#515](#515)) ([3756fd1](3756fd1))
* typecast null values in filter lists ([#515](#515)) ([3dcf4c8](3dcf4c8))

### Features

* add full set of commented-out Resource defaults in ApplicationResource when using the generator ([367678e](367678e))
* **generators:** explicit rendering by default, respond_with only when Responders is included ([70741fe](70741fe))
* in-tree plain ruby and sinatra examples ([b92c6d9](b92c6d9))
* ship the Rails application template in this repo ([76d5329](76d5329))
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.0.0-beta.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistent behaviour for empty polymorphic

2 participants