Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions JsonApiDotNetCore/JsonApi/DocumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,23 @@ private Dictionary<string, string> BuildSelfLink(string protocol, string host, s
};
}

private Dictionary<string, string> GetRelationshipLinks(IJsonApiResource resource, string relationshipName)
private Dictionary<string, Dictionary<string, string>> GetRelationshipLinks(IJsonApiResource resource, string relationshipName)
{
return BuildRelationshipLinks(_context.HttpContext.Request.Scheme,
_context.HttpContext.Request.Host.ToString(), _context.Configuration.Namespace,
_context.GetEntityName(), resource.Id, relationshipName);
}

private Dictionary<string, string> BuildRelationshipLinks(string protocol, string host, string nameSpace, string resourceCollectionName, string resourceId, string relationshipName)
private Dictionary<string, Dictionary<string, string>> BuildRelationshipLinks(string protocol, string host, string nameSpace, string resourceCollectionName, string resourceId, string relationshipName)
{
return new Dictionary<string, string>
return new Dictionary<string, Dictionary<string, string>>
{
{"self", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/relationships/{relationshipName}"},
{"related", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/{relationshipName}"}
{
"links", new Dictionary<string, string> {
{"self", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/relationships/{relationshipName}"},
{"related", $"{protocol}://{host}/{nameSpace}/{resourceCollectionName}/{resourceId}/{relationshipName}"}
}
}
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion JsonApiDotNetCore/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.1",
"version": "0.1.2",
"packOptions": {
"licenseUrl": "https://github.com/Research-Institute/json-api-dotnet-core/tree/master/JsonApiDotNetCore/LICENSE",
"projectUrl": "https://github.com/Research-Institute/json-api-dotnet-core/"
Expand Down
2 changes: 1 addition & 1 deletion JsonApiDotNetCoreExample/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"JsonApiDotNetCore": "0.1.1",
"JsonApiDotNetCore": "0.1.2",
"Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
Expand Down
2 changes: 1 addition & 1 deletion JsonApiDotNetCoreTests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "1.0.0-alpha",
"testRunner": "xunit",
"dependencies": {
"JsonApiDotNetCore": "0.1.1",
"JsonApiDotNetCore": "0.1.2",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"xunit": "2.2.0-beta2-build3300",
"moq": "4.6.38-alpha"
Expand Down