Skip to content

Commit 2c3f516

Browse files
author
Bart Koelman
authored
Merge 861dc80 into 3e982ec
2 parents 3e982ec + 861dc80 commit 2c3f516

File tree

220 files changed

+2664
-1617
lines changed

Some content is hidden

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

220 files changed

+2664
-1617
lines changed

JsonApiDotNetCore.sln.DotSettings

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$, $NAME$);</s:String>
7878
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TailRecursiveCall/@EntryIndexedValue">SUGGESTION</s:String>
7979
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TryCastAlwaysSucceeds/@EntryIndexedValue">WARNING</s:String>
8080
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnnecessaryWhitespace/@EntryIndexedValue">HINT</s:String>
81+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseArrayEmptyMethod/@EntryIndexedValue">WARNING</s:String>
8182
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionCountProperty/@EntryIndexedValue">WARNING</s:String>
83+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseEmptyTypesField/@EntryIndexedValue">WARNING</s:String>
84+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseEventArgsEmptyField/@EntryIndexedValue">WARNING</s:String>
8285
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VirtualMemberNeverOverridden_002ELocal/@EntryIndexedValue">WARNING</s:String>
8386
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=JADNC_0020Full_0020Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="JADNC Full Cleanup"&gt;&lt;XMLReformatCode&gt;True&lt;/XMLReformatCode&gt;&lt;CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" /&gt;&lt;CssAlphabetizeProperties&gt;True&lt;/CssAlphabetizeProperties&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;FormatAttributeQuoteDescriptor&gt;True&lt;/FormatAttributeQuoteDescriptor&gt;&lt;CorrectVariableKindsDescriptor&gt;True&lt;/CorrectVariableKindsDescriptor&gt;&lt;VariablesToInnerScopesDescriptor&gt;True&lt;/VariablesToInnerScopesDescriptor&gt;&lt;StringToTemplatesDescriptor&gt;True&lt;/StringToTemplatesDescriptor&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsFormatDocComments&gt;True&lt;/JsFormatDocComments&gt;&lt;RemoveRedundantQualifiersTs&gt;True&lt;/RemoveRedundantQualifiersTs&gt;&lt;OptimizeImportsTs&gt;True&lt;/OptimizeImportsTs&gt;&lt;OptimizeReferenceCommentsTs&gt;True&lt;/OptimizeReferenceCommentsTs&gt;&lt;PublicModifierStyleTs&gt;True&lt;/PublicModifierStyleTs&gt;&lt;ExplicitAnyTs&gt;True&lt;/ExplicitAnyTs&gt;&lt;TypeAnnotationStyleTs&gt;True&lt;/TypeAnnotationStyleTs&gt;&lt;RelativePathStyleTs&gt;True&lt;/RelativePathStyleTs&gt;&lt;AsInsteadOfCastTs&gt;True&lt;/AsInsteadOfCastTs&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;AspOptimizeRegisterDirectives&gt;True&lt;/AspOptimizeRegisterDirectives&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;CSArrangeQualifiers&gt;True&lt;/CSArrangeQualifiers&gt;&lt;CSFixBuiltinTypeReferences&gt;True&lt;/CSFixBuiltinTypeReferences&gt;&lt;CssReformatCode&gt;True&lt;/CssReformatCode&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;XAMLCollapseEmptyTags&gt;False&lt;/XAMLCollapseEmptyTags&gt;&lt;/Profile&gt;</s:String>
8487
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">JADNC Full Cleanup</s:String>
@@ -620,15 +623,19 @@ $left$ = $right$;</s:String>
620623
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B3D9EE6B4EC62A4F961EB15F9ADEC2C6/ReplacePattern/@EntryValue">$collection$.IsNullOrEmpty()</s:String>
621624
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B3D9EE6B4EC62A4F961EB15F9ADEC2C6/SearchPattern/@EntryValue">$collection$ == null || !$collection$.Any()</s:String>
622625
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=B3D9EE6B4EC62A4F961EB15F9ADEC2C6/Severity/@EntryValue">WARNING</s:String>
626+
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
623627
<s:Boolean x:Key="/Default/UserDictionary/Words/=Assignee/@EntryIndexedValue">True</s:Boolean>
624628
<s:Boolean x:Key="/Default/UserDictionary/Words/=Injectables/@EntryIndexedValue">True</s:Boolean>
629+
<s:Boolean x:Key="/Default/UserDictionary/Words/=jsonapi/@EntryIndexedValue">True</s:Boolean>
625630
<s:Boolean x:Key="/Default/UserDictionary/Words/=linebreaks/@EntryIndexedValue">True</s:Boolean>
626631
<s:Boolean x:Key="/Default/UserDictionary/Words/=Microservices/@EntryIndexedValue">True</s:Boolean>
627632
<s:Boolean x:Key="/Default/UserDictionary/Words/=navigations/@EntryIndexedValue">True</s:Boolean>
633+
<s:Boolean x:Key="/Default/UserDictionary/Words/=parallelize/@EntryIndexedValue">True</s:Boolean>
628634
<s:Boolean x:Key="/Default/UserDictionary/Words/=playlists/@EntryIndexedValue">True</s:Boolean>
629635
<s:Boolean x:Key="/Default/UserDictionary/Words/=Rewriter/@EntryIndexedValue">True</s:Boolean>
630636
<s:Boolean x:Key="/Default/UserDictionary/Words/=Startups/@EntryIndexedValue">True</s:Boolean>
631637
<s:Boolean x:Key="/Default/UserDictionary/Words/=subdirectory/@EntryIndexedValue">True</s:Boolean>
632638
<s:Boolean x:Key="/Default/UserDictionary/Words/=unarchive/@EntryIndexedValue">True</s:Boolean>
633639
<s:Boolean x:Key="/Default/UserDictionary/Words/=Workflows/@EntryIndexedValue">True</s:Boolean>
640+
<s:Boolean x:Key="/Default/UserDictionary/Words/=xunit/@EntryIndexedValue">True</s:Boolean>
634641
</wpf:ResourceDictionary>

benchmarks/Serialization/JsonApiDeserializerBenchmarks.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ public JsonApiDeserializerBenchmarks()
3838
IResourceGraph resourceGraph = _dependencyFactory.CreateResourceGraph(options);
3939

4040
var serviceContainer = new ServiceContainer();
41-
serviceContainer.AddService(typeof(IResourceDefinitionAccessor), new ResourceDefinitionAccessor(resourceGraph, serviceContainer));
41+
var resourceDefinitionAccessor = new ResourceDefinitionAccessor(resourceGraph, serviceContainer);
42+
43+
serviceContainer.AddService(typeof(IResourceDefinitionAccessor), resourceDefinitionAccessor);
4244
serviceContainer.AddService(typeof(IResourceDefinition<BenchmarkResource>), new JsonApiResourceDefinition<BenchmarkResource>(resourceGraph));
4345

4446
var targetedFields = new TargetedFields();
4547
var request = new JsonApiRequest();
4648
var resourceFactory = new ResourceFactory(serviceContainer);
4749
var httpContextAccessor = new HttpContextAccessor();
4850

49-
_jsonApiDeserializer = new RequestDeserializer(resourceGraph, resourceFactory, targetedFields, httpContextAccessor, request, options);
51+
_jsonApiDeserializer = new RequestDeserializer(resourceGraph, resourceFactory, targetedFields, httpContextAccessor, request, options,
52+
resourceDefinitionAccessor);
5053
}
5154

5255
[Benchmark]

docs/docfx.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
}
99
],
1010
"dest": "api",
11-
"disableGitFeatures": false,
12-
"properties": {
13-
"targetFramework": "netcoreapp3.1"
14-
}
11+
"disableGitFeatures": false
1512
}
1613
],
1714
"build": {

docs/internals/queries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Processing a request involves the following steps:
1818
- The readers also implement `IQueryConstraintProvider`, which exposes expressions through `ExpressionInScope` objects.
1919
- `QueryLayerComposer` (used from `JsonApiResourceService`) collects all query constraints.
2020
- It combines them with default options and `IResourceDefinition` overrides and composes a tree of `QueryLayer` objects.
21-
- It lifts the tree for nested endpoints like /blogs/1/articles and rewrites includes.
21+
- It lifts the tree for secondary endpoints like /blogs/1/articles and rewrites includes.
2222
- `JsonApiResourceService` contains no more usage of `IQueryable`.
2323
- `EntityFrameworkCoreRepository` delegates to `QueryableBuilder` to transform the `QueryLayer` tree into `IQueryable` expression trees.
2424
`QueryBuilder` depends on `QueryClauseBuilder` implementations that visit the tree nodes, transforming them to `System.Linq.Expression` equivalents.

docs/usage/extensibility/resource-definitions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public class EmployeeDefinition : JsonApiResourceDefinition<Employee>
202202
{
203203
}
204204

205-
public override IReadOnlyCollection<IncludeElementExpression> OnApplyIncludes(
206-
IReadOnlyCollection<IncludeElementExpression> existingIncludes)
205+
public override IImmutableList<IncludeElementExpression> OnApplyIncludes(
206+
IImmutableList<IncludeElementExpression> existingIncludes)
207207
{
208208
if (existingIncludes.Any(include =>
209209
include.Relationship.Property.Name == nameof(Employee.Manager)))

docs/usage/extensibility/services.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ public class TodoItemService : JsonApiResourceService<TodoItem>
1818
public TodoItemService(IResourceRepositoryAccessor repositoryAccessor,
1919
IQueryLayerComposer queryLayerComposer, IPaginationContext paginationContext,
2020
IJsonApiOptions options, ILoggerFactory loggerFactory, IJsonApiRequest request,
21-
IResourceChangeTracker<TodoItem> resourceChangeTracker)
21+
IResourceChangeTracker<TodoItem> resourceChangeTracker,
22+
IResourceDefinitionAccessor resourceDefinitionAccessor)
2223
: base(repositoryAccessor, queryLayerComposer, paginationContext, options,
23-
loggerFactory, request, resourceChangeTracker)
24+
loggerFactory, request, resourceChangeTracker, resourceDefinitionAccessor)
2425
{
2526
_notificationService = notificationService;
2627
}

docs/usage/reading/including-relationships.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ which is equivalent to:
6262
GET /api/articles?include=author&include=author.livingAddress&include=author.livingAddress.country
6363
```
6464

65-
This can be used on nested endpoints too:
65+
This can be used on secondary endpoints too:
6666

6767
```http
6868
GET /api/blogs/1/articles?include=author.livingAddress.country

docs/usage/reading/pagination.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ Resources can be paginated. This request would fetch the second page of 10 artic
66
GET /articles?page[size]=10&page[number]=2 HTTP/1.1
77
```
88

9-
## Nesting
10-
11-
Pagination can be used on nested endpoints, such as:
9+
Pagination can be used on secondary endpoints, such as:
1210

1311
```http
1412
GET /blogs/1/articles?page[number]=2 HTTP/1.1

docs/usage/reading/sorting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ GET /api/blogs?sort=count(articles) HTTP/1.1
3434

3535
This sorts the list of blogs by their number of articles.
3636

37-
## Nesting
37+
## Secondary endpoints
3838

39-
Sorting can be used on nested endpoints, such as:
39+
Sorting can be used on secondary endpoints, such as:
4040

4141
```http
4242
GET /api/blogs/1/articles?sort=caption HTTP/1.1

docs/usage/reading/sparse-fieldset-selection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
As an alternative to returning all fields (attributes and relationships) from a resource, the `fields[]` query string parameter can be used to select a subset.
44
Put the resource type to apply the fieldset on between the brackets.
5-
This can be used on the resource being requested, as well as on nested endpoints and/or included resources.
5+
This can be used on primary and secondary endpoints. The selection is applied on both primary and included resources.
66

7-
Top-level example:
7+
Primary endpoint example:
88

99
```http
1010
GET /articles?fields[articles]=title,body,comments HTTP/1.1
1111
```
1212

13-
Nested endpoint example:
13+
Secondary endpoint example:
1414

1515
```http
1616
GET /api/blogs/1/articles?fields[articles]=title,body,comments HTTP/1.1

0 commit comments

Comments
 (0)