Skip to content

Ability to turn off self and related links globally #451

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

Closed
milosloub opened this issue Nov 22, 2018 · 0 comments
Closed

Ability to turn off self and related links globally #451

milosloub opened this issue Nov 22, 2018 · 0 comments

Comments

@milosloub
Copy link
Contributor

milosloub commented Nov 22, 2018

Description

If you provide [HasOne] or [HasMany] attribute, self and related links are presented by default.
Example:

{
  "type": "articles",
  "id": "4309",
  "relationships": {
     "author": {
       "links": {
         "self": "/api/v1/articles/4309/relationships/author",
         "related": "/api/v1/articles/4309/author"
       }
     }
  }
}

To turn them off, now it's necessary to provide extra parameter - [HasOne(documentLinks: Link.None)].

To turn them off globaly, there should be something like:
options.DefaultRelationshipLinks = Link.None;
With output:

{
  "type": "articles",
  "id": "4309",
  "relationships": {
     "author": { }
     }
  }
}

Environment

  • JsonApiDotNetCore Version: 3.0.0
@milosloub milosloub mentioned this issue Nov 22, 2018
jaredcnance added a commit that referenced this issue Nov 29, 2018
Feat/#451 Global relationship link settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants