Skip to content

Commit 8c7e1a8

Browse files
committed
Merge branch 'master' into merge-master-into-openapi
2 parents ae81441 + 1ff2456 commit 8c7e1a8

File tree

55 files changed

+74
-806
lines changed

Some content is hidden

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

55 files changed

+74
-806
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# I don't want to read this whole thing I just have a question!!!
22

3-
> Note: Please don't file an issue to ask a question.
4-
5-
You'll get faster results by using our official [Gitter channel](https://gitter.im/json-api-dotnet-core/Lobby) or [StackOverflow](https://stackoverflow.com/search?q=jsonapidotnetcore) where the community chimes in with helpful advice if you have questions.
3+
> You can file an issue to ask a question, but you'll get faster results by using our official [Gitter channel](https://gitter.im/json-api-dotnet-core/Lobby) or [StackOverflow](https://stackoverflow.com/search?q=jsonapidotnetcore) where the community chimes in with helpful advice if you have questions.
64
75
# How can I contribute?
86

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: ''
5-
labels: ''
5+
labels: 'bug'
66
assignees: ''
77

88
---
99

10-
_Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before submitting a bug._
10+
<!-- Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before submitting a bug. -->
1111

1212
#### DESCRIPTION
13-
_A clear and concise description of what the bug is._
13+
<!-- A clear and concise description of what the bug is. -->
1414

1515
#### STEPS TO REPRODUCE
16-
_Consider to include your code here, such as models, DbContext, controllers, resource services, repositories, resource definitions etc. Please also include the request URL with body (if applicable) and the full exception stack trace (set `options.IncludeExceptionStackTraceInErrors` to `true`) in case of errors._ It may also be helpful to include the produced SQL, which can be made visible in logs by adding this to appsettings.json:
16+
<!-- Consider to include your code here, such as models, DbContext, controllers, resource services, repositories, resource definitions etc. Please also include the request URL with body (if applicable) and the full exception stack trace (set `options.IncludeExceptionStackTraceInErrors` to `true`) in case of errors._ It may also be helpful to include the produced SQL, which can be made visible in logs by adding this to appsettings.json:
1717
1818
```json
1919
{
@@ -24,16 +24,17 @@ _Consider to include your code here, such as models, DbContext, controllers, res
2424
}
2525
}
2626
```
27+
-->
2728

2829
1.
2930
2.
3031
3.
3132

3233
#### EXPECTED BEHAVIOR
33-
_A clear and concise description of what you expected to happen._
34+
<!-- A clear and concise description of what you expected to happen. -->
3435

3536
#### ACTUAL BEHAVIOR
36-
_A clear and concise description of what happens instead._
37+
<!-- A clear and concise description of what happens instead. -->
3738

3839
#### VERSIONS USED
3940
- JsonApiDotNetCore version:

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
name: Feature request
33
about: Suggest an idea for this project
44
title: ''
5-
labels: ''
5+
labels: 'enhancement'
66
assignees: ''
77

88
---
99

10-
_Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before suggesting an idea._
10+
<!-- Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before suggesting an idea. -->
1111

1212
**Is your feature request related to a problem? Please describe.**
13-
_A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]_
13+
<!-- A clear and concise description of what the problem is. For example: I'm always frustrated when... -->
1414

1515
**Describe the solution you'd like**
16-
_A clear and concise description of what you want to happen._
16+
<!-- A clear and concise description of what you want to happen. -->
1717

1818
**Describe alternatives you've considered**
19-
_A clear and concise description of any alternative solutions or features you've considered._
19+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
2020

2121
**Additional context**
22-
_Add any other context or screenshots about the feature request here._
22+
<!-- Add any other context or screenshots about the feature request here. -->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Question
3+
about: Ask a question
4+
title: ''
5+
labels: 'question'
6+
assignees: ''
7+
8+
---
9+
10+
#### SUMMARY
11+
<!-- Explain what you're trying to accomplish, how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself. -->
12+
13+
#### DETAILS
14+
<!-- What details can you include that will help us identify and solve your problem? -->
15+
16+
#### STEPS TO REPRODUCE
17+
<!-- Not all questions benefit from including code, but if your problem is with the code you've written, you should consider including your models, DbContext, controllers, resource services, repositories, resource definitions, etc. Include the request URL with body (if applicable) and the full exception stack trace (set `options.IncludeExceptionStackTraceInErrors` to `true`) in case of errors. It may also be helpful to include the produced SQL, which can be made visible in logs by adding this to appsettings.json:
18+
19+
```json
20+
{
21+
"Logging": {
22+
"LogLevel": {
23+
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
24+
}
25+
}
26+
}
27+
```
28+
-->
29+
30+
1.
31+
2.
32+
3.
33+
34+
#### VERSIONS USED
35+
- JsonApiDotNetCore version:
36+
- ASP.NET Core version:
37+
- Entity Framework Core version:
38+
- Database provider:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Closes #{ISSUE_NUMBER}
44

55
#### QUALITY CHECKLIST
66
- [ ] Changes implemented in code
7-
- [ ] Complies with our [contributing guidelines](./.github/CONTRIBUTING.md)
7+
- [ ] Complies with our [contributing guidelines](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md)
88
- [ ] Adapted tests
99
- [ ] Documentation updated

Directory.Build.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<AspNetVersion>6.0.*</AspNetVersion>
55
<EFCoreVersion>6.0.*</EFCoreVersion>
66
<EFCorePostgresVersion>6.0.*</EFCorePostgresVersion>
7-
<MicrosoftCodeAnalysisVersion>4.1.*</MicrosoftCodeAnalysisVersion>
7+
<MicrosoftCodeAnalysisVersion>4.2.*</MicrosoftCodeAnalysisVersion>
88
<HumanizerVersion>2.14.1</HumanizerVersion>
99
<SwashbuckleVersion>6.2.*</SwashbuckleVersion>
10-
<JsonApiDotNetCoreVersionPrefix>5.0.2</JsonApiDotNetCoreVersionPrefix>
10+
<JsonApiDotNetCoreVersionPrefix>5.0.3</JsonApiDotNetCoreVersionPrefix>
1111
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
1212
<WarningLevel>9999</WarningLevel>
1313
<Nullable>enable</Nullable>
@@ -17,8 +17,8 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
21-
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.0" PrivateAssets="All" />
20+
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="All" />
21+
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.1" PrivateAssets="All" />
2222
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
2323
</ItemGroup>
2424

@@ -35,7 +35,7 @@
3535
<!-- Test Project Dependencies -->
3636
<PropertyGroup>
3737
<CoverletVersion>3.1.2</CoverletVersion>
38-
<MoqVersion>4.17.2</MoqVersion>
39-
<TestSdkVersion>17.1.0</TestSdkVersion>
38+
<MoqVersion>4.18.1</MoqVersion>
39+
<TestSdkVersion>17.2.0</TestSdkVersion>
4040
</PropertyGroup>
4141
</Project>

JsonApiDotNetCore.sln

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestBuildingBlocks", "test\
4646
EndProject
4747
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.SourceGenerators", "src\JsonApiDotNetCore.SourceGenerators\JsonApiDotNetCore.SourceGenerators.csproj", "{952C0FDE-AFC8-455C-986F-6CC882ED8953}"
4848
EndProject
49-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorDebugger", "test\SourceGeneratorDebugger\SourceGeneratorDebugger.csproj", "{87D066F9-3540-4AC7-A748-134900969EE5}"
50-
EndProject
5149
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorTests", "test\SourceGeneratorTests\SourceGeneratorTests.csproj", "{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}"
5250
EndProject
5351
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.Annotations", "src\JsonApiDotNetCore.Annotations\JsonApiDotNetCore.Annotations.csproj", "{83FF097C-C8C6-477B-9FAB-DF99B84978B5}"
@@ -242,18 +240,6 @@ Global
242240
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x64.Build.0 = Release|Any CPU
243241
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.ActiveCfg = Release|Any CPU
244242
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.Build.0 = Release|Any CPU
245-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
246-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
247-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.ActiveCfg = Debug|Any CPU
248-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.Build.0 = Debug|Any CPU
249-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.ActiveCfg = Debug|Any CPU
250-
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.Build.0 = Debug|Any CPU
251-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
252-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.Build.0 = Release|Any CPU
253-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.ActiveCfg = Release|Any CPU
254-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.Build.0 = Release|Any CPU
255-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.ActiveCfg = Release|Any CPU
256-
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.Build.0 = Release|Any CPU
257243
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
258244
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
259245
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -369,7 +355,6 @@ Global
369355
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
370356
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
371357
{952C0FDE-AFC8-455C-986F-6CC882ED8953} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
372-
{87D066F9-3540-4AC7-A748-134900969EE5} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
373358
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
374359
{83FF097C-C8C6-477B-9FAB-DF99B84978B5} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
375360
{60334658-BE51-43B3-9C4D-F2BBF56C89CE} = {026FBC6C-AF76-4568-9B87-EC73457899FD}

src/JsonApiDotNetCore.Annotations/Resources/Annotations/ResourceAttribute.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using JetBrains.Annotations;
22
using JsonApiDotNetCore.Controllers;
33

4-
// ReSharper disable CheckNamespace
5-
#pragma warning disable AV1505 // Namespace should match with assembly name
6-
74
namespace JsonApiDotNetCore.Resources.Annotations;
85

96
/// <summary>

src/JsonApiDotNetCore.SourceGenerators/ControllerSourceGenerator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414
namespace JsonApiDotNetCore.SourceGenerators
1515
{
16+
// To debug in Visual Studio (requires v17.2 or higher):
17+
// - Set JsonApiDotNetCore.SourceGenerators as startup project
18+
// - Add a breakpoint at the start of the Initialize or Execute method
19+
// - Optional: change targetProject in Properties\launchSettings.json
20+
// - Press F5
21+
1622
[Generator(LanguageNames.CSharp)]
1723
public sealed class ControllerSourceGenerator : ISourceGenerator
1824
{

src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848

4949
<ItemGroup>
5050
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" PrivateAssets="all" GeneratePathProperty="true" />
51-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" />
51+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" PrivateAssets="all" />
5252
</ItemGroup>
5353
</Project>

src/JsonApiDotNetCore.SourceGenerators/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"JsonApiDotNetCore.SourceGenerators": {
44
"commandName": "DebugRoslynComponent",
5-
"targetProject": "..\\..\\test\\SourceGeneratorDebugger\\SourceGeneratorDebugger.csproj"
5+
"targetProject": "..\\Examples\\JsonApiDotNetCoreExample\\JsonApiDotNetCoreExample.csproj"
66
}
77
}
88
}

src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using Microsoft.EntityFrameworkCore;
77
using Microsoft.Extensions.DependencyInjection;
88

9-
#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
10-
119
namespace JsonApiDotNetCore.Configuration;
1210

1311
[PublicAPI]

src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static CascadingCodeTimer()
1818
{
1919
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2020
{
21-
// Be default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
21+
// By default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
2222
// The steps below ensure to get an accuracy of 0.1%-0.2%. With this accuracy, algorithms can be tested and compared.
2323
// https://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi
2424

src/JsonApiDotNetCore/Queries/Expressions/QueryableHandlerExpression.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ public QueryableHandlerExpression(object queryableHandler, StringValues paramete
2121
_parameterValue = parameterValue;
2222
}
2323

24-
#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
2524
public IQueryable<TResource> Apply<TResource>(IQueryable<TResource> query)
2625
where TResource : class, IIdentifiable
27-
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
2826
{
2927
var handler = (Func<IQueryable<TResource>, StringValues, IQueryable<TResource>>)_queryableHandler;
3028
return handler(query, _parameterValue);

src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ public virtual async Task<int> CountAsync(FilterExpression? filter, Cancellation
105105
}
106106
}
107107

108-
#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
109108
protected virtual IQueryable<TResource> ApplyQueryLayer(QueryLayer queryLayer)
110-
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
111109
{
112110
_traceWriter.LogMethodStart(new
113111
{
@@ -151,9 +149,7 @@ protected virtual IQueryable<TResource> ApplyQueryLayer(QueryLayer queryLayer)
151149
}
152150
}
153151

154-
#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
155152
protected virtual IQueryable<TResource> GetAll()
156-
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
157153
{
158154
return _dbContext.Set<TResource>();
159155
}

src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,9 @@ private static (Expression? innerExpression, bool isCount) TryReadCount(Expressi
114114

115115
private Expression? ReadAttribute(Expression expression)
116116
{
117-
if (expression is MemberExpression memberExpression)
117+
if (expression is MemberExpression { Expression: { } } memberExpression)
118118
{
119-
ResourceType resourceType = memberExpression.Member.Name == nameof(Identifiable<object>.Id) && memberExpression.Expression != null
120-
? _resourceGraph.GetResourceType(memberExpression.Expression.Type)
121-
: _resourceGraph.GetResourceType(memberExpression.Member.DeclaringType!);
122-
119+
ResourceType resourceType = _resourceGraph.GetResourceType(memberExpression.Expression.Type);
123120
AttrAttribute? attribute = resourceType.FindAttributeByPropertyName(memberExpression.Member.Name);
124121

125122
if (attribute != null)

test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void Can_convert_chain_of_ToOne_relationships_ending_in_attribute()
3737
string[] expected =
3838
{
3939
"-fileEntries:content",
40-
"fileSystemEntries:name",
40+
"fileEntries:name",
4141
"fileEntries:length",
4242
"fileSystemEntries:parent.fileSystemEntries:name",
4343
"fileSystemEntries:parent.fileSystemEntries:parent.fileSystemEntries:name"
@@ -103,7 +103,7 @@ public void Can_convert_chain_with_conversion_to_derived_types()
103103
"fileSystemEntries:parent.fileEntries:content",
104104
"count(directoryEntries:subdirectories)",
105105
"count(fileSystemEntries:parent.directoryEntries:files)",
106-
"-fileSystemEntries:name"
106+
"-directoryEntries:name"
107107
};
108108

109109
expression.ToFullString().Should().Be(string.Join(',', expected));

test/SourceGeneratorDebugger/Controllers/ArticlesController.cs

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

test/SourceGeneratorDebugger/Controllers/CustomersController.cs

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

test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs

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

test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs

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

0 commit comments

Comments
 (0)