Skip to content

Disable Links Objects #129

Closed
Closed
@jaredcnance

Description

@jaredcnance

Should be able to disable relational link navigation.

Probably include a param in the relational attribute constructor:

public class Item : Identifiable
{
  [HasOne("owner", Link.None)]
  public virtual Person Owner { get; set; } 
  public int OwnerId { get; set; } 
}

May also disable links per resource, at the document level:

[Links(Link.None)]
public class Item : Identifiable
{ 
  // ...
}

And globally:

public IServiceProvider ConfigureServices(IServiceCollection services) {
    services.AddJsonApi<DbContext>(
        opt.BuildContextGraph(builder => {
             builder.DocumentLinks = Links.Self | Links.Paging;
        });
    // ...
}

Possible flags:

[Flags]
public enum Links
{
    None = 0,
    Self  = 1 << 0,
    Paging = 1 << 1,
    Related  = 1 << 2,
    All = ~(-1 << 3)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions