Skip to content

Conversation

@johvet
Copy link

@johvet johvet commented Mar 29, 2021

What is the current behavior?

  • the links on a relationship configuration can only take a Symbol or a Hash
  • there is no way to reduce/filter the attributes to serialize in a single call
  • there is no way to reduce/filter the relationships to serialize in a single call

What is the new behavior?

  • the links on a relationship configuration can now take a callable providing all links for the relationship
  • added an attributes_filter method taking a class method name or a block as argument
  • added a relationships_filter method taking a class method name or a block as argument

Checklist

Please make sure the following requirements are complete:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes /
    features)
  • All automated checks pass (CI/CD)

@johvet johvet changed the title Johvet/callable relationship links Callable relationship links Mar 29, 2021
@stas
Copy link
Collaborator

stas commented Apr 3, 2021

@johvet thank you for the PR, but I'd like to not introduce new features in the v2.x

The pending rewrite #141 already provides support for this functionality though:
https://github.com/jsonapi-serializer/jsonapi-serializer/pull/141/files#diff-d375de8e3ef8cd99b8f0bb7d734098098cbf6c2e253f29efba0f6472bf32d1afR274

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants