Skip to content

Commit 3447bae

Browse files
committed
feat(operations): remove JSON pointers from previous spec draft
1 parent e78a3f3 commit 3447bae

File tree

6 files changed

+7
-157
lines changed

6 files changed

+7
-157
lines changed

src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ public static void SerializeAsJsonApi(this MvcOptions options, JsonApiOptions js
163163
{
164164
options.InputFormatters.Insert(0, new JsonApiInputFormatter());
165165

166-
if (jsonApiOptions.EnabledExtensions.Contains(JsonApiExtension.Operations))
167-
options.InputFormatters.Insert(0, new JsonApiOperationsInputFormatter());
168-
169166
options.OutputFormatters.Insert(0, new JsonApiOutputFormatter());
170167

171168
options.Conventions.Insert(0, new DasherizedRoutingConvention(jsonApiOptions.Namespace));

src/JsonApiDotNetCore/Formatters/JsonApiOperationsInputFormatter.cs

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

src/JsonApiDotNetCore/Services/Operations/DocumentDataPointerReplacement.cs

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

src/JsonApiDotNetCore/Services/Operations/OperationsProcessor.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ private async Task ProcessOperation(Operation op, List<Operation> outputOps)
6161
{
6262
var operationsPointer = new OperationsPointer();
6363

64-
ReplaceDataPointers(op.DataObject, outputOps);
65-
ReplaceRefPointers(op.Ref, outputOps);
64+
// ReplaceDataPointers(op.DataObject, outputOps);
65+
// ReplaceRefPointers(op.Ref, outputOps);
6666

6767
var processor = GetOperationsProcessor(op);
6868
var resultOp = await processor.ProcessAsync(op);
@@ -71,22 +71,6 @@ private async Task ProcessOperation(Operation op, List<Operation> outputOps)
7171
outputOps.Add(resultOp);
7272
}
7373

74-
private void ReplaceDataPointers(DocumentData dataObject, List<Operation> outputOps)
75-
{
76-
if (dataObject == null) return;
77-
78-
var replacer = new DocumentDataPointerReplacement<OperationsPointer, Operation>(dataObject);
79-
replacer.ReplacePointers(outputOps);
80-
}
81-
82-
private void ReplaceRefPointers(ResourceReference resourceRef, List<Operation> outputOps)
83-
{
84-
if (resourceRef == null) return;
85-
86-
var replacer = new ResourceRefPointerReplacement<OperationsPointer, Operation>(resourceRef);
87-
replacer.ReplacePointers(outputOps);
88-
}
89-
9074
private IOpProcessor GetOperationsProcessor(Operation op)
9175
{
9276
switch (op.Op)

src/JsonApiDotNetCore/Services/Operations/ResourceRefPointerReplacement.cs

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

test/OperationsExampleTests/WebHostCollection.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
using System;
21
using System.Net.Http;
2+
using System.Net.Http.Headers;
3+
using System.Threading.Tasks;
34
using Microsoft.AspNetCore.Hosting;
4-
using OperationsExample;
5-
using Xunit;
65
using Microsoft.AspNetCore.TestHost;
76
using Newtonsoft.Json;
8-
using System.Net.Http.Headers;
9-
using System.Threading.Tasks;
10-
using JsonApiDotNetCore.Formatters;
7+
using OperationsExample;
8+
using Xunit;
119

1210
namespace OperationsExampleTests
1311
{
@@ -35,7 +33,6 @@ public async Task<HttpResponseMessage> PatchAsync(string route, object data)
3533
request.Content = new StringContent(JsonConvert.SerializeObject(data));
3634
request.Content.Headers.ContentLength = 1;
3735
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.api+json");
38-
request.Content.Headers.Add("Link", JsonApiOperationsInputFormatter.PROFILE_EXTENSION);
3936
return await Client.SendAsync(request);
4037
}
4138

@@ -47,4 +44,4 @@ public async Task<HttpResponseMessage> PatchAsync(string route, object data)
4744
return (response, obj);
4845
}
4946
}
50-
}
47+
}

0 commit comments

Comments
 (0)