Skip to content

Merge 0-4-0 into master #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions JSONAPI.EntityFramework.Tests.TestWebApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ public void Configuration(IAppBuilder app)

private static HttpConfiguration GetWebApiConfiguration()
{
var pluralizationService = new PluralizationService();
var httpConfig = new HttpConfiguration();

// Configure the model manager
var pluralizationService = new PluralizationService();
var modelManager = new ModelManager(pluralizationService)
.RegisterResourceType(typeof (Comment))
.RegisterResourceType(typeof (Post))
.RegisterResourceType(typeof (Tag))
.RegisterResourceType(typeof (User))
.RegisterResourceType(typeof (UserGroup));

// Configure JSON API
new JsonApiConfiguration()
.PluralizeResourceTypesWith(pluralizationService)
new JsonApiConfiguration(modelManager)
.UseEntityFramework()
.RegisterResourceType(typeof(Comment))
.RegisterResourceType(typeof(Post))
.RegisterResourceType(typeof(Tag))
.RegisterResourceType(typeof(User))
.RegisterResourceType(typeof(UserGroup))
.Apply(httpConfig);


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"author": {
"linkage": [ { "type": "users", "id": "403" } ]
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"id": "202",
"links": {
"tags": {
"data": []
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "202",
"links": {
"tags": {
"ids": [ "301" ]
"linkage": null
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"type": "posts",
"id": "202",
"links": {
"author": null
"author": {
"linkage": null
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"tags": {
"linkage": { "type": "tags", "id": "301" }
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"tags": {
"linkage": "301"
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "202",
"links": {
"author": {
"type": "users"
"linkage": "403"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "202",
"links": {
"tags": {
"type": "tags"
"linkage": []
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "202",
"links": {
"tags": {
"data": [
"linkage": [
{
"id": "301",
"type": "tags"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"tags": {
"linkage": [ { "type": "tags" } ]
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"tags": {
"linkage": [ { "id": "301" } ]
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"id": "202",
"links": {
"tags": {
"type": "tags",
"ids": ["301"]
"linkage": [ { "type": "tags", "id": "301" } ]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": [
{
"type": "posts",
"id": "202",
"links": {
"author": {
"linkage": { "type": "users" }
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "202",
"links": {
"author": {
"id": "403"
"linkage": { "id": "403" }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"id": "202",
"links": {
"author": {
"type": "users",
"id": "403"
"linkage": {
"type": "users",
"id": "403"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"created": "2015-03-11T04:31:00+00:00",
"links": {
"author": {
"type": "users",
"id": "401"
"linkage": {
"type": "users",
"id": "401"

}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Nothing was specified for the `type` property.",
"detail": "Expected an object value for `linkage` but got Array.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "The value of a to-many relationship must be an object.",
"detail": "Each relationship key on a links object must have an object value.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Expected an array value for `linkage` but no `linkage` key was found.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Nothing was specified for the `id` property.",
"detail": "Expected an array value for `linkage` but got Null.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "If `data` is not specified, then `ids` must be specified.",
"detail": "Expected an array value for `linkage` but got Object.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "If `data` is not specified, then `type` must be specified.",
"detail": "Expected an array value for `linkage` but got String.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Expected an object value for `linkage` but got String.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "The value of a to-one relationship must be an object or null.",
"detail": "Each relationship key on a links object must have an object value.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Each linkage object must have a string value for the key `id`.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Each linkage object must have a string value for the key `type`.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Each linkage object must have a string value for the key `id`.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors": [
{
"id": "{{SOME_GUID}}",
"status": "500",
"title": "JSONAPI.Json.JsonApiFormatter+BadRequestException",
"detail": "Each linkage object must have a string value for the key `type`.",
"stackTrace": "{{STACK_TRACE}}",
"inner": null
}
]
}
Loading