Skip to content

Ability to turn off self and related links globally #451

@milosloub

Description

@milosloub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions