-
-
Notifications
You must be signed in to change notification settings - Fork 158
Feat/#451 #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#451 #452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a minor comment. But, I'm open to this solution as well.
/// options.DisableSelfAndRelatedLinks = true; | ||
/// </code> | ||
/// </example> | ||
public bool DisableSelfAndRelatedLinks { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be the global default Link
. Maybe something like:
public Link DefaultRelationshipLinks { get; set;} = Link.All
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense with Link.All. I thought about this more and got following:
a) we can expose new property on JsonApiOptions "DefaultRelationshipLinks" (instead of DisableSelfAndRelatedLinks )
b) we can use present property ResourceGraphBuilder on JsonApiOptions, set it's DocumentLinks and than check this property while building resource in DocumentBuilder.cs.
Second solution might be breaking change, if you are developer who set it like this before. But I can´t imagine why anyone would do this.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think option "a" would be better so we can distinguish between the resource level links and the relationship links. That being said, we should probably move the ResourceGraphBuilder.DocumentLinks
into JsonApiOptions
as well. Ideally, since auto discovery has landed, ResourceGraphBuilder
shouldn't be necessary for most applications.
For now I did it like options.DefaultRelationshipLinks. I didn't move DocumentLinks. If you want to do it at once - this will lead to change unit test Page_Links_Can_Be_Disabled_Globally. |
Closes #451