Skip to content

Merge master into openapi #1163

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 9 commits into from
Jun 26, 2022
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
4 changes: 1 addition & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# I don't want to read this whole thing I just have a question!!!

> Note: Please don't file an issue to ask a question.

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.
> 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.

# How can I contribute?

Expand Down
13 changes: 7 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: 'bug'
assignees: ''

---

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

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

#### STEPS TO REPRODUCE
_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:
<!-- 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:

```json
{
Expand All @@ -24,16 +24,17 @@ _Consider to include your code here, such as models, DbContext, controllers, res
}
}
```
-->

1.
2.
3.

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

#### ACTUAL BEHAVIOR
_A clear and concise description of what happens instead._
<!-- A clear and concise description of what happens instead. -->

#### VERSIONS USED
- JsonApiDotNetCore version:
Expand Down
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---

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

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

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

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

**Additional context**
_Add any other context or screenshots about the feature request here._
<!-- Add any other context or screenshots about the feature request here. -->
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Question
about: Ask a question
title: ''
labels: 'question'
assignees: ''

---

#### SUMMARY
<!-- 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. -->

#### DETAILS
<!-- What details can you include that will help us identify and solve your problem? -->

#### STEPS TO REPRODUCE
<!-- 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:

```json
{
"Logging": {
"LogLevel": {
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
}
}
```
-->

1.
2.
3.

#### VERSIONS USED
- JsonApiDotNetCore version:
- ASP.NET Core version:
- Entity Framework Core version:
- Database provider:
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Closes #{ISSUE_NUMBER}

#### QUALITY CHECKLIST
- [ ] Changes implemented in code
- [ ] Complies with our [contributing guidelines](./.github/CONTRIBUTING.md)
- [ ] Complies with our [contributing guidelines](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md)
- [ ] Adapted tests
- [ ] Documentation updated
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<AspNetVersion>6.0.*</AspNetVersion>
<EFCoreVersion>6.0.*</EFCoreVersion>
<EFCorePostgresVersion>6.0.*</EFCorePostgresVersion>
<MicrosoftCodeAnalysisVersion>4.1.*</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisVersion>4.2.*</MicrosoftCodeAnalysisVersion>
<HumanizerVersion>2.14.1</HumanizerVersion>
<SwashbuckleVersion>6.2.*</SwashbuckleVersion>
<JsonApiDotNetCoreVersionPrefix>5.0.2</JsonApiDotNetCoreVersionPrefix>
<JsonApiDotNetCoreVersionPrefix>5.0.3</JsonApiDotNetCoreVersionPrefix>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
<WarningLevel>9999</WarningLevel>
<Nullable>enable</Nullable>
Expand All @@ -17,8 +17,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="All" />
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.1" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
</ItemGroup>

Expand All @@ -35,7 +35,7 @@
<!-- Test Project Dependencies -->
<PropertyGroup>
<CoverletVersion>3.1.2</CoverletVersion>
<MoqVersion>4.17.2</MoqVersion>
<TestSdkVersion>17.1.0</TestSdkVersion>
<MoqVersion>4.18.1</MoqVersion>
<TestSdkVersion>17.2.0</TestSdkVersion>
</PropertyGroup>
</Project>
15 changes: 0 additions & 15 deletions JsonApiDotNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestBuildingBlocks", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.SourceGenerators", "src\JsonApiDotNetCore.SourceGenerators\JsonApiDotNetCore.SourceGenerators.csproj", "{952C0FDE-AFC8-455C-986F-6CC882ED8953}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorDebugger", "test\SourceGeneratorDebugger\SourceGeneratorDebugger.csproj", "{87D066F9-3540-4AC7-A748-134900969EE5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorTests", "test\SourceGeneratorTests\SourceGeneratorTests.csproj", "{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.Annotations", "src\JsonApiDotNetCore.Annotations\JsonApiDotNetCore.Annotations.csproj", "{83FF097C-C8C6-477B-9FAB-DF99B84978B5}"
Expand Down Expand Up @@ -242,18 +240,6 @@ Global
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x64.Build.0 = Release|Any CPU
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.ActiveCfg = Release|Any CPU
{952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.Build.0 = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.ActiveCfg = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.Build.0 = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.ActiveCfg = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.Build.0 = Debug|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.Build.0 = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.ActiveCfg = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.Build.0 = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.ActiveCfg = Release|Any CPU
{87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.Build.0 = Release|Any CPU
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -369,7 +355,6 @@ Global
{EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{952C0FDE-AFC8-455C-986F-6CC882ED8953} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
{87D066F9-3540-4AC7-A748-134900969EE5} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{83FF097C-C8C6-477B-9FAB-DF99B84978B5} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
{60334658-BE51-43B3-9C4D-F2BBF56C89CE} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using JetBrains.Annotations;
using JsonApiDotNetCore.Controllers;

// ReSharper disable CheckNamespace
#pragma warning disable AV1505 // Namespace should match with assembly name

namespace JsonApiDotNetCore.Resources.Annotations;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

namespace JsonApiDotNetCore.SourceGenerators
{
// To debug in Visual Studio (requires v17.2 or higher):
// - Set JsonApiDotNetCore.SourceGenerators as startup project
// - Add a breakpoint at the start of the Initialize or Execute method
// - Optional: change targetProject in Properties\launchSettings.json
// - Press F5

[Generator(LanguageNames.CSharp)]
public sealed class ControllerSourceGenerator : ISourceGenerator
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@

<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" PrivateAssets="all" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"JsonApiDotNetCore.SourceGenerators": {
"commandName": "DebugRoslynComponent",
"targetProject": "..\\..\\test\\SourceGeneratorDebugger\\SourceGeneratorDebugger.csproj"
"targetProject": "..\\Examples\\JsonApiDotNetCoreExample\\JsonApiDotNetCoreExample.csproj"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection

namespace JsonApiDotNetCore.Configuration;

[PublicAPI]
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static CascadingCodeTimer()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Be default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
// By default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
// The steps below ensure to get an accuracy of 0.1%-0.2%. With this accuracy, algorithms can be tested and compared.
// https://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public QueryableHandlerExpression(object queryableHandler, StringValues paramete
_parameterValue = parameterValue;
}

#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
public IQueryable<TResource> Apply<TResource>(IQueryable<TResource> query)
where TResource : class, IIdentifiable
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
{
var handler = (Func<IQueryable<TResource>, StringValues, IQueryable<TResource>>)_queryableHandler;
return handler(query, _parameterValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ public virtual async Task<int> CountAsync(FilterExpression? filter, Cancellation
}
}

#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
protected virtual IQueryable<TResource> ApplyQueryLayer(QueryLayer queryLayer)
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
{
_traceWriter.LogMethodStart(new
{
Expand Down Expand Up @@ -151,9 +149,7 @@ protected virtual IQueryable<TResource> ApplyQueryLayer(QueryLayer queryLayer)
}
}

#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
protected virtual IQueryable<TResource> GetAll()
#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection
{
return _dbContext.Set<TResource>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ private static (Expression? innerExpression, bool isCount) TryReadCount(Expressi

private Expression? ReadAttribute(Expression expression)
{
if (expression is MemberExpression memberExpression)
if (expression is MemberExpression { Expression: { } } memberExpression)
{
ResourceType resourceType = memberExpression.Member.Name == nameof(Identifiable<object>.Id) && memberExpression.Expression != null
? _resourceGraph.GetResourceType(memberExpression.Expression.Type)
: _resourceGraph.GetResourceType(memberExpression.Member.DeclaringType!);

ResourceType resourceType = _resourceGraph.GetResourceType(memberExpression.Expression.Type);
AttrAttribute? attribute = resourceType.FindAttributeByPropertyName(memberExpression.Member.Name);

if (attribute != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void Can_convert_chain_of_ToOne_relationships_ending_in_attribute()
string[] expected =
{
"-fileEntries:content",
"fileSystemEntries:name",
"fileEntries:name",
"fileEntries:length",
"fileSystemEntries:parent.fileSystemEntries:name",
"fileSystemEntries:parent.fileSystemEntries:parent.fileSystemEntries:name"
Expand Down Expand Up @@ -103,7 +103,7 @@ public void Can_convert_chain_with_conversion_to_derived_types()
"fileSystemEntries:parent.fileEntries:content",
"count(directoryEntries:subdirectories)",
"count(fileSystemEntries:parent.directoryEntries:files)",
"-fileSystemEntries:name"
"-directoryEntries:name"
};

expression.ToFullString().Should().Be(string.Join(',', expected));
Expand Down
16 changes: 0 additions & 16 deletions test/SourceGeneratorDebugger/Controllers/ArticlesController.cs

This file was deleted.

18 changes: 0 additions & 18 deletions test/SourceGeneratorDebugger/Controllers/CustomersController.cs

This file was deleted.

19 changes: 0 additions & 19 deletions test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs

This file was deleted.

15 changes: 0 additions & 15 deletions test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs

This file was deleted.

Loading