Skip to content

Consistent handling of multiple Links with same rel #157

Closed
@chrylis

Description

@chrylis

The current Link handling in ResourceSupport uses a List as its store and will add a new Link regardless of whether one with the specified relation is already present. However, the hasLink and getLink methods traverse the list and stop at the first match. This makes sense for hasLink, but there's a semantic inconsistency with getLink: either ResourceSupport should only permit a single Link per relation type (maybe converting to a Map internally; getLinks should probably be generalized to Collection anyway), or the getter should return all links matching the specified relation, perhaps with a specialized getSingleLink.

(This issue cropped up because I'm trying to model an artwork/artist scenario where the artist relation should be directly embedded on the artwork resource, not redirected through a collection resource, but some works need multiple artists.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions