Skip to content

Commit b4b5a95

Browse files
authored
Merge 10e9ad9 into 978a311
2 parents 978a311 + 10e9ad9 commit b4b5a95

File tree

294 files changed

+11417
-2565
lines changed

Some content is hidden

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

294 files changed

+11417
-2565
lines changed

.config/dotnet-tools.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2021.3.0",
6+
"version": "2021.3.4",
77
"commands": [
88
"jb"
99
]
1010
},
1111
"regitlint": {
12-
"version": "6.0.6",
12+
"version": "6.0.8",
1313
"commands": [
1414
"regitlint"
1515
]
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
"dotnet-reportgenerator-globaltool": {
24-
"version": "5.0.0",
24+
"version": "5.1.3",
2525
"commands": [
2626
"reportgenerator"
2727
]

CodingGuidelines.ruleset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
<Rule Id="AV1555" Action="Warning" />
1515
<Rule Id="AV1564" Action="Info" />
1616
<Rule Id="AV1568" Action="Warning" />
17+
<Rule Id="AV1580" Action="None" />
1718
<Rule Id="AV1706" Action="Warning" />
1819
<Rule Id="AV1710" Action="Info" />
1920
<Rule Id="AV1711" Action="Info" />
2021
<Rule Id="AV1738" Action="Warning" />
2122
<Rule Id="AV1739" Action="Warning" />
2223
<Rule Id="AV1745" Action="Warning" />
2324
<Rule Id="AV1755" Action="Warning" />
24-
<Rule Id="AV2210" Action="None" />
25+
<Rule Id="AV2210" Action="Warning" />
2526
<Rule Id="AV2220" Action="Warning" />
2627
<Rule Id="AV2230" Action="Info" />
2728
<Rule Id="AV2305" Action="None" />

Directory.Build.props

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AspNetVersion>6.0.*</AspNetVersion>
55
<EFCoreVersion>6.0.*</EFCoreVersion>
66
<EFCorePostgresVersion>6.0.*</EFCorePostgresVersion>
7-
<MicrosoftCodeAnalysisVersion>4.0.*</MicrosoftCodeAnalysisVersion>
7+
<MicrosoftCodeAnalysisVersion>4.1.*</MicrosoftCodeAnalysisVersion>
88
<HumanizerVersion>2.*</HumanizerVersion>
99
<JsonApiDotNetCoreVersionPrefix>5.0.0</JsonApiDotNetCoreVersionPrefix>
1010
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
@@ -17,7 +17,7 @@
1717

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

@@ -27,10 +27,14 @@
2727
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2828
</PropertyGroup>
2929

30+
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
31+
<NoWarn>$(NoWarn);AV2210</NoWarn>
32+
</PropertyGroup>
33+
3034
<!-- Test Project Dependencies -->
3135
<PropertyGroup>
3236
<CoverletVersion>3.1.2</CoverletVersion>
33-
<MoqVersion>4.16.1</MoqVersion>
37+
<MoqVersion>4.17.2</MoqVersion>
3438
<TestSdkVersion>17.1.0</TestSdkVersion>
3539
</PropertyGroup>
3640
</Project>

benchmarks/Serialization/ResourceSerializationBenchmarks.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,19 @@ protected override IEvaluatedIncludeCache CreateEvaluatedIncludeCache(IResourceG
127127
RelationshipAttribute multi4 = resourceAType.GetRelationshipByPropertyName(nameof(OutgoingResource.Multi4));
128128
RelationshipAttribute multi5 = resourceAType.GetRelationshipByPropertyName(nameof(OutgoingResource.Multi5));
129129

130-
ImmutableArray<ResourceFieldAttribute> chain = ImmutableArray.Create<ResourceFieldAttribute>(single2, single3, multi4, multi5);
131-
IEnumerable<ResourceFieldChainExpression> chains = new ResourceFieldChainExpression(chain).AsEnumerable();
132-
133-
var converter = new IncludeChainConverter();
134-
IncludeExpression include = converter.FromRelationshipChains(chains);
130+
var include = new IncludeExpression(new HashSet<IncludeElementExpression>
131+
{
132+
new(single2, new HashSet<IncludeElementExpression>
133+
{
134+
new(single3, new HashSet<IncludeElementExpression>
135+
{
136+
new(multi4, new HashSet<IncludeElementExpression>
137+
{
138+
new(multi5)
139+
}.ToImmutableHashSet())
140+
}.ToImmutableHashSet())
141+
}.ToImmutableHashSet())
142+
}.ToImmutableHashSet());
135143

136144
var cache = new EvaluatedIncludeCache();
137145
cache.Set(include);

benchmarks/Serialization/SerializationBenchmarkBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ public Task OnSetToManyRelationshipAsync<TResource>(TResource leftResource, HasM
180180
return Task.CompletedTask;
181181
}
182182

183-
public Task OnAddToRelationshipAsync<TResource, TId>(TId leftResourceId, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds,
183+
public Task OnAddToRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds,
184184
CancellationToken cancellationToken)
185-
where TResource : class, IIdentifiable<TId>
185+
where TResource : class, IIdentifiable
186186
{
187187
return Task.CompletedTask;
188188
}
@@ -245,7 +245,7 @@ public RelationshipLinks GetRelationshipLinks(RelationshipAttribute relationship
245245

246246
private sealed class FakeMetaBuilder : IMetaBuilder
247247
{
248-
public void Add(IReadOnlyDictionary<string, object?> values)
248+
public void Add(IDictionary<string, object?> values)
249249
{
250250
}
251251

docs/usage/reading/filtering.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Expressions are composed using the following functions:
2424
| Ends with text | `endsWith` | `?filter=endsWith(description,'End')` |
2525
| Equals one value from set | `any` | `?filter=any(chapter,'Intro','Summary','Conclusion')` |
2626
| Collection contains items | `has` | `?filter=has(articles)` |
27+
| Type-check derived type (v5) | `isType` | `?filter=isType(,men)` |
2728
| Negation | `not` | `?filter=not(equals(lastName,null))` |
2829
| Conditional logical OR | `or` | `?filter=or(has(orders),has(invoices))` |
2930
| Conditional logical AND | `and` | `?filter=and(has(orders),has(invoices))` |
@@ -86,6 +87,31 @@ GET /customers?filter=has(orders,not(equals(status,'Paid'))) HTTP/1.1
8687

8788
Which returns only customers that have at least one unpaid order.
8889

90+
_since v5.0_
91+
92+
Use the `isType` filter function to perform a type check on a derived type. You can pass a nested filter, where the derived fields are accessible.
93+
The first parameter can be used to perform the type check on a to-one relationship path.
94+
95+
Only return men:
96+
```http
97+
GET /humans?filter=isType(,men) HTTP/1.1
98+
```
99+
100+
Only return men with beards:
101+
```http
102+
GET /humans?filter=isType(,men,equals(hasBeard,'true')) HTTP/1.1
103+
```
104+
105+
Only return people whose best friend is a man with children:
106+
```http
107+
GET /humans?filter=isType(bestFriend,men,has(children)) HTTP/1.1
108+
```
109+
110+
Only return people who have at least one female married child:
111+
```http
112+
GET /humans?filter=has(children,isType(,woman,not(equals(husband,null)))) HTTP/1.1
113+
```
114+
89115
# Legacy filters
90116

91117
The next section describes how filtering worked in versions prior to v4.0. They are always applied on the set of resources being requested (no nesting).

0 commit comments

Comments
 (0)