Skip to content

Commit 0704cc6

Browse files
Maurits MoeysMaurits Moeys
authored andcommitted
feat: decoupled deserializer and serializer
1 parent d672e8e commit 0704cc6

File tree

108 files changed

+8039
-1712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+8039
-1712
lines changed

src/JsonApiDotNetCore/Builders/IDocumentBuilderOptionsProvider.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/JsonApiDotNetCore/Builders/ILinkBuilder.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/JsonApiDotNetCore/Builders/LinkBuilder.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/JsonApiDotNetCore/Builders/MetaBuilder.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using JsonApiDotNetCore.Models.Links;
2+
3+
namespace JsonApiDotNetCore.Configuration
4+
{
5+
public interface IGlobalLinksConfiguration
6+
{
7+
bool RelativeLinks { get; set; }
8+
Link RelationshipLinks { get; set; }
9+
Link TopLevelLinks { get; set; }
10+
Link ResourceLinks { get; set; }
11+
}
12+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// REF: https://github.com/aspnet/Entropy/blob/dev/samples/Mvc.CustomRoutingConvention/NameSpaceRoutingConvention.cs
2+
// REF: https://github.com/aspnet/Mvc/issues/5691
3+
using System.Reflection;
4+
using JsonApiDotNetCore.Controllers;
5+
using JsonApiDotNetCore.Extensions;
6+
using Microsoft.AspNetCore.Mvc.ApplicationModels;
7+
8+
namespace JsonApiDotNetCore.Internal
9+
{
10+
public class DasherizedRoutingConvention : IApplicationModelConvention
11+
{
12+
private readonly string _namespace;
13+
public DasherizedRoutingConvention(string nspace)
14+
{
15+
_namespace = nspace;
16+
}
17+
18+
public void Apply(ApplicationModel application)
19+
{
20+
foreach (var controller in application.Controllers)
21+
{
22+
if (IsDasherizedJsonApiController(controller) == false)
23+
continue;
24+
25+
var template = $"{_namespace}/{controller.ControllerName.Dasherize()}";
26+
controller.Selectors[0].AttributeRouteModel = new AttributeRouteModel
27+
{
28+
Template = template
29+
};
30+
}
31+
}
32+
33+
private bool IsDasherizedJsonApiController(ControllerModel controller)
34+
{
35+
var type = controller.ControllerType;
36+
var notDisabled = type.GetCustomAttribute<DisableRoutingConventionAttribute>() == null;
37+
return notDisabled && type.IsSubclassOf(typeof(JsonApiControllerMixin));
38+
}
39+
}
40+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace JsonApiDotNetCore.Internal.Contracts
2+
{
3+
public interface IContextEntityProvider
4+
{
5+
}
6+
}

src/JsonApiDotNetCore/Internal/PageManager.cs

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
using JsonApiDotNetCore.Models;
3+
4+
namespace JsonApiDotNetCore.Serialization
5+
{
6+
7+
public interface IUpdatedFieldsManager
8+
{
9+
List<AttrAttribute> AttributesToUpdate { get; set; }
10+
List<RelationshipAttribute> RelationshipsToUpdate { get; set; }
11+
}
12+
13+
public interface IUpdatedFieldManager_ProposalWithDictionaries
14+
{
15+
Dictionary<IIdentifiable, List<AttrAttribute>> AttributesToUpdate { get; set; }
16+
Dictionary<IIdentifiable, List<RelationshipAttribute>> RelationshipsToUpdate { get; set; }
17+
}
18+
}

0 commit comments

Comments
 (0)