Skip to content

Commit 31d2414

Browse files
authored
Merge pull request #13 from Research-Institute/v0.1.2
fix relationship links
2 parents 777b280 + 8bee5ba commit 31d2414

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

JsonApiDotNetCore/JsonApi/DocumentBuilder.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,23 @@ private Dictionary<string, string> BuildSelfLink(string protocol, string host, s
105105
};
106106
}
107107

108-
private Dictionary<string, string> GetRelationshipLinks(IJsonApiResource resource, string relationshipName)
108+
private Dictionary<string, Dictionary<string, string>> GetRelationshipLinks(IJsonApiResource resource, string relationshipName)
109109
{
110110
return BuildRelationshipLinks(_context.HttpContext.Request.Scheme,
111111
_context.HttpContext.Request.Host.ToString(), _context.Configuration.Namespace,
112112
_context.GetEntityName(), resource.Id, relationshipName);
113113
}
114114

115-
private Dictionary<string, string> BuildRelationshipLinks(string protocol, string host, string nameSpace, string resourceCollectionName, string resourceId, string relationshipName)
115+
private Dictionary<string, Dictionary<string, string>> BuildRelationshipLinks(string protocol, string host, string nameSpace, string resourceCollectionName, string resourceId, string relationshipName)
116116
{
117-
return new Dictionary<string, string>
117+
return new Dictionary<string, Dictionary<string, string>>
118118
{
119-
{"self", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/relationships/{relationshipName}"},
120-
{"related", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/{relationshipName}"}
119+
{
120+
"links", new Dictionary<string, string> {
121+
{"self", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/relationships/{relationshipName}"},
122+
{"related", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/{relationshipName}"}
123+
}
124+
}
121125
};
122126
}
123127
}

JsonApiDotNetCore/project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.1",
2+
"version": "0.1.2",
33
"packOptions": {
44
"licenseUrl": "https://github.com/Research-Institute/json-api-dotnet-core/tree/master/JsonApiDotNetCore/LICENSE",
55
"projectUrl": "https://github.com/Research-Institute/json-api-dotnet-core/"

JsonApiDotNetCoreExample/project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"Microsoft.Extensions.Logging.Console": "1.0.0",
1212
"Microsoft.Extensions.Logging.Debug": "1.0.0",
1313
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
14-
"JsonApiDotNetCore": "0.1.1",
14+
"JsonApiDotNetCore": "0.1.2",
1515
"Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0",
1616
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
1717
},

JsonApiDotNetCoreTests/project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "1.0.0-alpha",
33
"testRunner": "xunit",
44
"dependencies": {
5-
"JsonApiDotNetCore": "0.1.1",
5+
"JsonApiDotNetCore": "0.1.2",
66
"dotnet-test-xunit": "2.2.0-preview2-build1029",
77
"xunit": "2.2.0-beta2-build3300",
88
"moq": "4.6.38-alpha"

0 commit comments

Comments
 (0)