Repository navigation
Conversation
Passing include: to a serializer that declares no relationships raised NoMethodError, because relationships_to_serialize is nil until the first relationship is defined. validate_includes! now treats nil as no relationships, so the documented UnsupportedIncludeError is raised. Fixes jsonapi-serializer#210. Based on the fix proposed in jsonapi-serializer#236. Co-authored-by: Oliver Hohn <17027801+oliver-hohn@users.noreply.github.com>
NewCops is enabled and RuboCop is unpinned, so CI started failing on master with Style/EmptyClassDefinition and Style/DirectiveScope before any tests ran.
ubuntu-latest moved to ubuntu-26.04, where ruby/setup-ruby has no builds for Ruby 2.7, 3.0 or 3.1, so those jobs failed before running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #210, based on the fix @oliver-hohn proposed in #236 (credited as co-author).
Bug: passing
include:to a serializer that declares no relationships raisedNoMethodError: undefined method '[]' for nil, becauserelationships_to_serializestaysniluntil a relationship is defined.validate_includes!now treatsnilas no relationships, so the documentedUnsupportedIncludeErroris raised. A spec covers it usingUserSerializer, which has no relationships.CI: master no longer passes, for two reasons unrelated to this fix, so I've included two small commits to get CI green again:
NewCops: enable, and RuboCop 1.92 reportsStyle/EmptyClassDefinitionandStyle/DirectiveScopeinserialization_core.rb. Fixed without changing behaviour. Pinning RuboCop would stop this recurring, but I've left that to you.ubuntu-latestis now Ubuntu 26.04, whereruby/setup-rubyhas no Ruby 2.7, 3.0 or 3.1 builds. The job now runs onubuntu-24.04, so the matrix stays the same.Results on my fork: Ruby 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 and head pass (24 examples, 0 failures, no RuboCop offenses): https://github.com/komal0000/jsonapi-serializer/actions/runs/40108791816
Without the fix, the new spec fails with the exact
NoMethodErrorfrom #210.truffleruby-headstill fails: RuboCop itself errors while inspectingserialization_core.rbon the TruffleRuby nightly. It does this on the unchanged code too, so it isn't caused by this PR.Happy to help with the other open PRs and issues as well (see #254).