Skip to content

Commit 237a1d7

Browse files
authored
Merge branch 'master' into document-json-api-endpoints-enum
2 parents 748d2df + f38a812 commit 237a1d7

File tree

76 files changed

+2309
-742
lines changed

Some content is hidden

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

76 files changed

+2309
-742
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2023.1.2",
6+
"version": "2023.2.1",
77
"commands": [
88
"jb"
99
]

src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,16 @@ public Task<IReadOnlyCollection<TResource>> GetAsync(CancellationToken cancellat
8383
private void LogFiltersInTopScope()
8484
{
8585
// @formatter:wrap_chained_method_calls chop_always
86-
// @formatter:keep_existing_linebreaks true
86+
// @formatter:wrap_before_first_method_call true
8787

88-
FilterExpression[] filtersInTopScope = _constraintProviders.SelectMany(provider => provider.GetConstraints())
88+
FilterExpression[] filtersInTopScope = _constraintProviders
89+
.SelectMany(provider => provider.GetConstraints())
8990
.Where(constraint => constraint.Scope == null)
9091
.Select(constraint => constraint.Expression)
9192
.OfType<FilterExpression>()
9293
.ToArray();
9394

94-
// @formatter:keep_existing_linebreaks restore
95+
// @formatter:wrap_before_first_method_call restore
9596
// @formatter:wrap_chained_method_calls restore
9697

9798
FilterExpression? filter = LogicalExpression.Compose(LogicalOperator.And, filtersInTopScope);

src/JsonApiDotNetCore.Annotations/ArgumentGuard.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using SysNotNull = System.Diagnostics.CodeAnalysis.NotNullAttribute;
44

55
#pragma warning disable AV1008 // Class should not be static
6-
#pragma warning disable AV1553 // Do not use optional parameters with default value null for strings, collections or tasks
76

87
namespace JsonApiDotNetCore;
98

src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using JetBrains.Annotations;
22

3-
// ReSharper disable CheckNamespace
4-
#pragma warning disable AV1505 // Namespace should match with assembly name
5-
63
namespace JsonApiDotNetCore.Controllers;
74

85
// IMPORTANT: An internal copy of this type exists in the SourceGenerators project. Keep these in sync when making changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LambdaExpressionCanBeMadeStatic/@EntryIndexedValue">WARNING</s:String>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LambdaExpressionMustBeStatic/@EntryIndexedValue">WARNING</s:String>
4+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalFunctionCanBeMadeStatic/@EntryIndexedValue">WARNING</s:String>
5+
</wpf:ResourceDictionary>

src/JsonApiDotNetCore/Queries/EvaluatedIncludeCache.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ public void Set(IncludeExpression include)
3434
// then as a fallback, we feed the requested includes from query string to the response serializer.
3535

3636
// @formatter:wrap_chained_method_calls chop_always
37-
// @formatter:keep_existing_linebreaks true
37+
// @formatter:wrap_before_first_method_call true
3838

39-
_include = _constraintProviders.SelectMany(provider => provider.GetConstraints())
39+
_include = _constraintProviders
40+
.SelectMany(provider => provider.GetConstraints())
4041
.Where(constraint => constraint.Scope == null)
4142
.Select(constraint => constraint.Expression)
4243
.OfType<IncludeExpression>()
4344
.FirstOrDefault();
4445

45-
// @formatter:keep_existing_linebreaks restore
46+
// @formatter:wrap_before_first_method_call restore
4647
// @formatter:wrap_chained_method_calls restore
4748
_isAssigned = true;
4849
}

src/JsonApiDotNetCore/Queries/Expressions/QueryExpressionRewriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override QueryExpression DefaultVisit(QueryExpression expression, TArgume
3434
return null;
3535
}
3636

37-
public override QueryExpression? VisitResourceFieldChain(ResourceFieldChainExpression expression, TArgument argument)
37+
public override QueryExpression VisitResourceFieldChain(ResourceFieldChainExpression expression, TArgument argument)
3838
{
3939
return expression;
4040
}

src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ public QueryLayerComposer(IEnumerable<IQueryConstraintProvider> constraintProvid
4848
ExpressionInScope[] constraints = _constraintProviders.SelectMany(provider => provider.GetConstraints()).ToArray();
4949

5050
// @formatter:wrap_chained_method_calls chop_always
51-
// @formatter:keep_existing_linebreaks true
51+
// @formatter:wrap_before_first_method_call true
5252

5353
FilterExpression[] filtersInTopScope = constraints
5454
.Where(constraint => constraint.Scope == null)
5555
.Select(constraint => constraint.Expression)
5656
.OfType<FilterExpression>()
5757
.ToArray();
5858

59-
// @formatter:keep_existing_linebreaks restore
59+
// @formatter:wrap_before_first_method_call restore
6060
// @formatter:wrap_chained_method_calls restore
6161

6262
return GetFilter(filtersInTopScope, primaryResourceType);
@@ -83,15 +83,15 @@ public QueryLayerComposer(IEnumerable<IQueryConstraintProvider> constraintProvid
8383
ExpressionInScope[] constraints = _constraintProviders.SelectMany(provider => provider.GetConstraints()).ToArray();
8484

8585
// @formatter:wrap_chained_method_calls chop_always
86-
// @formatter:keep_existing_linebreaks true
86+
// @formatter:wrap_before_first_method_call true
8787

8888
FilterExpression[] filtersInSecondaryScope = constraints
8989
.Where(constraint => constraint.Scope == null)
9090
.Select(constraint => constraint.Expression)
9191
.OfType<FilterExpression>()
9292
.ToArray();
9393

94-
// @formatter:keep_existing_linebreaks restore
94+
// @formatter:wrap_before_first_method_call restore
9595
// @formatter:wrap_chained_method_calls restore
9696

9797
FilterExpression? primaryFilter = GetFilter(Array.Empty<QueryExpression>(), hasManyRelationship.LeftType);
@@ -146,14 +146,14 @@ private QueryLayer ComposeTopLayer(IEnumerable<ExpressionInScope> constraints, R
146146
using IDisposable _ = CodeTimingSessionManager.Current.Measure("Top-level query composition");
147147

148148
// @formatter:wrap_chained_method_calls chop_always
149-
// @formatter:keep_existing_linebreaks true
149+
// @formatter:wrap_before_first_method_call true
150150

151151
QueryExpression[] expressionsInTopScope = constraints
152152
.Where(constraint => constraint.Scope == null)
153153
.Select(constraint => constraint.Expression)
154154
.ToArray();
155155

156-
// @formatter:keep_existing_linebreaks restore
156+
// @formatter:wrap_before_first_method_call restore
157157
// @formatter:wrap_chained_method_calls restore
158158

159159
PaginationExpression topPagination = GetPagination(expressionsInTopScope, resourceType);
@@ -174,15 +174,15 @@ private IncludeExpression ComposeChildren(QueryLayer topLayer, ICollection<Expre
174174
using IDisposable _ = CodeTimingSessionManager.Current.Measure("Nested query composition");
175175

176176
// @formatter:wrap_chained_method_calls chop_always
177-
// @formatter:keep_existing_linebreaks true
177+
// @formatter:wrap_before_first_method_call true
178178

179179
IncludeExpression include = constraints
180180
.Where(constraint => constraint.Scope == null)
181181
.Select(constraint => constraint.Expression)
182182
.OfType<IncludeExpression>()
183183
.FirstOrDefault() ?? IncludeExpression.Empty;
184184

185-
// @formatter:keep_existing_linebreaks restore
185+
// @formatter:wrap_before_first_method_call restore
186186
// @formatter:wrap_chained_method_calls restore
187187

188188
IImmutableSet<IncludeElementExpression> includeElements = ProcessIncludeSet(include.Elements, topLayer, new List<RelationshipAttribute>(), constraints);
@@ -212,15 +212,14 @@ private IImmutableSet<IncludeElementExpression> ProcessIncludeSet(IImmutableSet<
212212
};
213213

214214
// @formatter:wrap_chained_method_calls chop_always
215-
// @formatter:keep_existing_linebreaks true
215+
// @formatter:wrap_before_first_method_call true
216216

217217
QueryExpression[] expressionsInCurrentScope = constraints
218-
.Where(constraint =>
219-
constraint.Scope != null && constraint.Scope.Fields.SequenceEqual(relationshipChain))
218+
.Where(constraint => constraint.Scope != null && constraint.Scope.Fields.SequenceEqual(relationshipChain))
220219
.Select(constraint => constraint.Expression)
221220
.ToArray();
222221

223-
// @formatter:keep_existing_linebreaks restore
222+
// @formatter:wrap_before_first_method_call restore
224223
// @formatter:wrap_chained_method_calls restore
225224

226225
ResourceType resourceType = includeElement.Relationship.RightType;

src/JsonApiDotNetCore/Queries/SparseFieldSetCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public SparseFieldSetCache(IEnumerable<IQueryConstraintProvider> constraintProvi
2929
private static IDictionary<ResourceType, IImmutableSet<ResourceFieldAttribute>> BuildSourceTable(IEnumerable<IQueryConstraintProvider> constraintProviders)
3030
{
3131
// @formatter:wrap_chained_method_calls chop_always
32-
// @formatter:keep_existing_linebreaks true
32+
// @formatter:wrap_before_first_method_call true
3333

3434
KeyValuePair<ResourceType, SparseFieldSetExpression>[] sparseFieldTables = constraintProviders
3535
.SelectMany(provider => provider.GetConstraints())
@@ -40,7 +40,7 @@ private static IDictionary<ResourceType, IImmutableSet<ResourceFieldAttribute>>
4040
.SelectMany(table => table)
4141
.ToArray();
4242

43-
// @formatter:keep_existing_linebreaks restore
43+
// @formatter:wrap_before_first_method_call restore
4444
// @formatter:wrap_chained_method_calls restore
4545

4646
var mergedTable = new Dictionary<ResourceType, ImmutableHashSet<ResourceFieldAttribute>.Builder>();

src/JsonApiDotNetCore/QueryStrings/IncludeQueryStringParameterReader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ public virtual void Read(string parameterName, StringValues parameterValue)
4747
{
4848
try
4949
{
50+
// Workaround for https://youtrack.jetbrains.com/issue/RSRP-493256/Incorrect-possible-null-assignment
51+
// ReSharper disable once AssignNullToNotNullAttribute
5052
_includeExpression = GetInclude(parameterValue.ToString());
5153
}
5254
catch (QueryParseException exception)
5355
{
56+
// Workaround for https://youtrack.jetbrains.com/issue/RSRP-493256/Incorrect-possible-null-assignment
57+
// ReSharper disable once AssignNullToNotNullAttribute
5458
string specificMessage = exception.GetMessageWithPosition(parameterValue.ToString());
5559
throw new InvalidQueryStringParameterException(parameterName, "The specified include is invalid.", specificMessage, exception);
5660
}

0 commit comments

Comments
 (0)