Skip to content

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

Merged
merged 3 commits into from
Nov 29, 2018
Merged

Feat/#451 #452

merged 3 commits into from
Nov 29, 2018

Conversation

milosloub
Copy link
Contributor

Closes #451

Copy link
Contributor

@jaredcnance jaredcnance left a 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; }
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

@jaredcnance jaredcnance Nov 29, 2018

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.

@milosloub
Copy link
Contributor Author

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.

@jaredcnance jaredcnance merged commit 3ade2a7 into json-api-dotnet:master Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants