Skip to content

Commit 333fcff

Browse files
authored
Merge pull request #420 from json-api-dotnet/master
master → develop
2 parents 91e589f + 84f45a9 commit 333fcff

File tree

99 files changed

+3949
-734
lines changed

Some content is hidden

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

99 files changed

+3949
-734
lines changed

Diff for: .github/CONTRIBUTING.MD

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Contributing
2+
3+
## Workflow
4+
5+
1. Search through the issues to see if your particular issue has already been discovered and possibly addressed
6+
2. Open an issue if you can't find anything helpful
7+
3. Open a PR for proposed changes
8+
9+
## Commit Guidelines
10+
11+
I have chosen to loosely follow the [Angular Commit Guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit)
12+
13+
# Documentation
14+
15+
If you'd like to help us improve our documentation, please checkout our [GitHub pages repository](https://github.com/json-api-dotnet/json-api-dotnet.github.io) where we host our documentation.
16+
17+
# Backporting Features To Prior Releases
18+
19+
To backport a feature that has been approved and merged into `master`:
20+
21+
## Requester
22+
23+
Open an issue requesting the feature you would like backported. The change will be reviewed based on:
24+
25+
- compatibility
26+
- difficulty in porting the change
27+
- the added value the feature provides for users on the older versions
28+
- how difficult it is for users to migrate from the older version to the newer version
29+
30+
## Maintainer
31+
32+
- Checkout the version you want to apply the feature on top of and create a new branch to release the new version:
33+
```
34+
git checkout tags/v2.5.1 -b release/2.5.2
35+
```
36+
- Cherrypick the merge commit: `git cherry-pick {git commit SHA}`
37+
- Bump the package version in the csproj
38+
- Make any other compatibility, documentation or tooling related changes
39+
- Push the branch to origin and verify the build
40+
- Once the build is verified, create a GitHub release, tagging the release branch
41+
- Open a PR back to master with any other additions

Diff for: .github/ISSUE_TEMPLATE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Description
2+
3+
...
4+
5+
## Environment
6+
7+
- JsonApiDotNetCore Version:
8+
- Other Relevant Package Versions:

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
Closes #{ISSUE_NUMBER}
4+
5+
#### BUG FIX
6+
- [ ] reproduce issue in tests
7+
- [ ] fix issue
8+
- [ ] bump package version
9+
10+
#### FEATURE
11+
- [ ] write tests that address the requirements outlined in the issue
12+
- [ ] fulfill the feature requirements
13+
- [ ] bump package version
14+
15+
#### RELATED REPOSITORY UPDATES
16+
- does this feature require documentation? if so, open an issue in the [docs repo](https://github.com/json-api-dotnet/json-api-dotnet.github.io/issues/new)
17+
- does this feature break an API that is implemented in the templates repository? if so, [open an issue](https://github.com/json-api-dotnet/Templates/issues/new)

Diff for: Build.ps1

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ $revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)
2323

2424
dotnet restore
2525

26+
dotnet build ./src/Examples/GettingStarted/GettingStarted.csproj
27+
CheckLastExitCode
28+
2629
dotnet test ./test/UnitTests/UnitTests.csproj
2730
CheckLastExitCode
2831

@@ -35,7 +38,13 @@ CheckLastExitCode
3538
dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj
3639
CheckLastExitCode
3740

38-
dotnet build .\src\JsonApiDotNetCore -c Release
41+
dotnet test ./test/ResourceEntitySeparationExampleTests/ResourceEntitySeparationExampleTests.csproj
42+
CheckLastExitCode
43+
44+
dotnet test ./test/DiscoveryTests/DiscoveryTests.csproj
45+
CheckLastExitCode
46+
47+
dotnet build ./src/JsonApiDotNetCore/JsonApiDotNetCore.csproj -c Release
3948
CheckLastExitCode
4049

4150
Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"

Diff for: CONTRIBUTING.MD

-15
This file was deleted.

Diff for: JsonApiDotnetCore.sln

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
33
VisualStudioVersion = 15.0.27130.2010
44
MinimumVisualStudioVersion = 10.0.40219.1
@@ -45,6 +45,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEntitySeparationExa
4545
EndProject
4646
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEntitySeparationExampleTests", "test\ResourceEntitySeparationExampleTests\ResourceEntitySeparationExampleTests.csproj", "{6DFA30D7-1679-4333-9779-6FB678E48EF5}"
4747
EndProject
48+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GettingStarted", "src\Examples\GettingStarted\GettingStarted.csproj", "{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}"
49+
EndProject
50+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoveryTests", "test\DiscoveryTests\DiscoveryTests.csproj", "{09C0C8D8-B721-4955-8889-55CB149C3B5C}"
51+
EndProject
4852
Global
4953
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5054
Debug|Any CPU = Debug|Any CPU
@@ -187,6 +191,30 @@ Global
187191
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x64.Build.0 = Release|Any CPU
188192
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x86.ActiveCfg = Release|Any CPU
189193
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x86.Build.0 = Release|Any CPU
194+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
195+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|Any CPU.Build.0 = Debug|Any CPU
196+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x64.ActiveCfg = Debug|Any CPU
197+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x64.Build.0 = Debug|Any CPU
198+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x86.ActiveCfg = Debug|Any CPU
199+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x86.Build.0 = Debug|Any CPU
200+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|Any CPU.ActiveCfg = Release|Any CPU
201+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|Any CPU.Build.0 = Release|Any CPU
202+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x64.ActiveCfg = Release|Any CPU
203+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x64.Build.0 = Release|Any CPU
204+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x86.ActiveCfg = Release|Any CPU
205+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x86.Build.0 = Release|Any CPU
206+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
207+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
208+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x64.ActiveCfg = Debug|Any CPU
209+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x64.Build.0 = Debug|Any CPU
210+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x86.ActiveCfg = Debug|Any CPU
211+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x86.Build.0 = Debug|Any CPU
212+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
213+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|Any CPU.Build.0 = Release|Any CPU
214+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x64.ActiveCfg = Release|Any CPU
215+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x64.Build.0 = Release|Any CPU
216+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x86.ActiveCfg = Release|Any CPU
217+
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x86.Build.0 = Release|Any CPU
190218
EndGlobalSection
191219
GlobalSection(SolutionProperties) = preSolution
192220
HideSolutionNode = FALSE
@@ -205,6 +233,8 @@ Global
205233
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
206234
{F4097194-9415-418A-AB4E-315C5D5466AF} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
207235
{6DFA30D7-1679-4333-9779-6FB678E48EF5} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
236+
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
237+
{09C0C8D8-B721-4955-8889-55CB149C3B5C} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
208238
EndGlobalSection
209239
GlobalSection(ExtensibilityGlobals) = postSolution
210240
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}

Diff for: PULL_REQUEST_TEMPLATE.md

-11
This file was deleted.

Diff for: README.md

+36
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,39 @@ public class Startup
7575
}
7676
}
7777
```
78+
79+
### Development
80+
81+
Restore all nuget packages with:
82+
83+
```bash
84+
dotnet restore
85+
```
86+
87+
#### Testing
88+
89+
Running tests locally requires access to a postgresql database.
90+
If you have docker installed, this can be propped up via:
91+
92+
```bash
93+
docker run --rm --name jsonapi-dotnet-core-testing \
94+
-e POSTGRES_DB=JsonApiDotNetCoreExample \
95+
-e POSTGRES_USER=postgres \
96+
-e POSTGRES_PASSWORD=postgres \
97+
-p 5432:5432 \
98+
postgres
99+
```
100+
101+
And then to run the tests:
102+
103+
```bash
104+
dotnet test
105+
```
106+
107+
#### Cleaning
108+
109+
Sometimes the compiled files can be dirty / corrupt from other branches / failed builds.
110+
111+
```bash
112+
dotnet clean
113+
```

Diff for: appveyor.yml

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ branches:
1818
- master
1919
- develop
2020
- unstable
21+
- /release\/.+/
2122

2223
nuget:
2324
disable_publish_on_pr: true
@@ -38,6 +39,7 @@ test: off
3839
artifacts:
3940
- path: .\**\artifacts\**\*.nupkg
4041
name: NuGet
42+
4143
deploy:
4244
- provider: NuGet
4345
server: https://www.myget.org/F/research-institute/api/v2/package
@@ -47,17 +49,28 @@ deploy:
4749
symbol_server: https://www.myget.org/F/research-institute/symbols/api/v2/package
4850
on:
4951
branch: develop
52+
5053
- provider: NuGet
5154
server: https://www.myget.org/F/jadnc/api/v2/package
5255
api_key:
5356
secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3
5457
skip_symbols: false
5558
on:
5659
branch: unstable
60+
5761
- provider: NuGet
5862
name: production
63+
skip_symbols: false
5964
api_key:
6065
secure: /fsEOgG4EdtNd6DPmko9h3NxQwx1IGDcFreGTKd2KA56U2KEkpX/L/pCGpCIEf2s
6166
on:
6267
branch: master
6368
appveyor_repo_tag: true
69+
70+
- provider: NuGet
71+
skip_symbols: false
72+
api_key:
73+
secure: /fsEOgG4EdtNd6DPmko9h3NxQwx1IGDcFreGTKd2KA56U2KEkpX/L/pCGpCIEf2s
74+
on:
75+
branch: /release\/.+/
76+
appveyor_repo_tag: true

Diff for: benchmarks/Serialization/JsonApiDeserializer_Benchmarks.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Benchmarks.Serialization {
1717
public class JsonApiDeserializer_Benchmarks {
1818
private const string TYPE_NAME = "simple-types";
1919
private static readonly string Content = JsonConvert.SerializeObject(new Document {
20-
Data = new DocumentData {
20+
Data = new ResourceObject {
2121
Type = TYPE_NAME,
2222
Id = "1",
2323
Attributes = new Dictionary<string, object> {

Diff for: build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ dotnet test ./test/UnitTests/UnitTests.csproj
99
dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj
1010
dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
1111
dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj
12+
dotnet test ./test/ResourceEntitySeparationExampleTests/ResourceEntitySeparationExampleTests.csproj

Diff for: src/Examples/GettingStarted/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.db
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using GettingStarted.Models;
2+
using JsonApiDotNetCore.Controllers;
3+
using JsonApiDotNetCore.Services;
4+
5+
namespace GettingStarted
6+
{
7+
public class ArticlesController : JsonApiController<Article>
8+
{
9+
public ArticlesController(
10+
IJsonApiContext jsonApiContext,
11+
IResourceService<Article> resourceService)
12+
: base(jsonApiContext, resourceService)
13+
{ }
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using GettingStarted.Models;
2+
using JsonApiDotNetCore.Controllers;
3+
using JsonApiDotNetCore.Services;
4+
5+
namespace GettingStarted
6+
{
7+
public class PeopleController : JsonApiController<Person>
8+
{
9+
public PeopleController(
10+
IJsonApiContext jsonApiContext,
11+
IResourceService<Person> resourceService)
12+
: base(jsonApiContext, resourceService)
13+
{ }
14+
}
15+
}

Diff for: src/Examples/GettingStarted/Data/SampleDbContext.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using GettingStarted.Models;
2+
using GettingStarted.ResourceDefinitionExample;
3+
using Microsoft.EntityFrameworkCore;
4+
5+
namespace GettingStarted
6+
{
7+
public class SampleDbContext : DbContext
8+
{
9+
public SampleDbContext(DbContextOptions<SampleDbContext> options)
10+
: base(options)
11+
{ }
12+
13+
public DbSet<Article> Articles { get; set; }
14+
public DbSet<Person> People { get; set; }
15+
public DbSet<Model> Models { get; set; }
16+
}
17+
}

Diff for: src/Examples/GettingStarted/GettingStarted.csproj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Folder Include="wwwroot\" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="../../JsonApiDotNetCore/JsonApiDotNetCore.csproj" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
17+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
18+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
19+
</ItemGroup>
20+
21+
</Project>

Diff for: src/Examples/GettingStarted/Models/Article.cs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using JsonApiDotNetCore.Models;
2+
3+
namespace GettingStarted.Models
4+
{
5+
public class Article : Identifiable
6+
{
7+
[Attr]
8+
public string Title { get; set; }
9+
10+
[HasOne]
11+
public Person Author { get; set; }
12+
public int AuthorId { get; set; }
13+
}
14+
}

Diff for: src/Examples/GettingStarted/Models/Person.cs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections.Generic;
2+
using JsonApiDotNetCore.Models;
3+
4+
namespace GettingStarted.Models
5+
{
6+
public class Person : Identifiable
7+
{
8+
[Attr]
9+
public string Name { get; set; }
10+
11+
[HasMany]
12+
public List<Article> Articles { get; set; }
13+
}
14+
}

0 commit comments

Comments
 (0)