Skip to content

feat: Make auto-links optional without removing other links - #407

Merged
mattpolzin merged 4 commits into
beam-community:mainfrom
opallabs:flip-links-script-rebased
Apr 5, 2026
Merged

mattpolzin merged 4 commits into
beam-community:mainfrom
opallabs:flip-links-script-rebased

Conversation

@mattpolzin

Copy link
Copy Markdown
Member

I found the remove_links configuration to be less granular than needed in some cases. Specifically, if you want to be able to explicitly define some links but not also add the automatically generated links, you cannot do so:

  1. remove_links: false -> you get links added automatically
  2. remove_links: true -> you don't get your explicitly added links

What I decided is that a more useful take on the configuration might be to decide whether to add autogenerated links or not instead of deciding whether to remove all links or not. I did this with a new add_auto_links configuration.

In this PR, I am careful to not break existing configurations by leaving the remove_links behavior the same. I think that a future major release of this library could revisit these configuration options and come up with a more coherent single links configuration but that's a discussion for another day.

@mattpolzin
mattpolzin requested a review from a team as a code owner March 24, 2026 22:14
@mattpolzin
mattpolzin merged commit a1bcd21 into beam-community:main Apr 5, 2026
9 checks passed
@mattpolzin
mattpolzin deleted the flip-links-script-rebased branch April 5, 2026 14:33
Comment thread lib/jsonapi/serializer.ex
when is_list(data) do
auto_links =
data
|> view.pagination_links(conn, page, options)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good if "pagination links" didn't fall under "auto links"?

#479 draft proposal, FWIW.

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