Closed sergey-litvinov-work closed 6 years ago
I think this makes sense, but I'm not sure I understand the reasoning for calling this Top
. It sounds like it means "add the link for the collection, but not the items". Could we call it something like CollectionSelf
? In any case I think it should have Self
in the name. Does that make sense to you?
Totally makes sense. And as i renamed it to TopSelf and you merged it, i'm closing this defect. Thanks!
@joukevandermaas or if you think that CollectionSelf is better, i can rename it and make new PR
Hi Jouke,
I wanted to ask one thing and i can make PR to add it, but wanted to get your opinion about it.
We have a case when we have endpoint that returns collection of items and we don't want to add additional endpoint to get specific item. The problem with the links as by default it will generate both
self
in each item and thenlinks->self
at top level. We want to be able to generate top levelself
but withoutself
on each item level.Right now it's impossible as if i set
WithLinks(Saule.LinkType.Related);
in the resource description, then it wont generate bothself
links and we need that top one.Is it ok to add
LinkType.Top
like thisSo then i can specify
LinkTypes.Top
and it will display only toplinks.self
section withoutself
for each item.And to prevent existing behavior i can check in the code (ResourceSerializer.CreateTopLevelLinks) to render top
self
link only ifSo existing code will work fine as Self would be treated as Top too. And if someone doesnt want it, then he can specify it in the resource as
LinkType.Top & ~LinkType.Self