Skip to content

Various fixes and improvements #1114

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 29 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
25b2692
Fixed inconsistencies in naming of resource type
Nov 16, 2021
8d17666
Fixed: Query to determine initial state is sent to the read-only data…
Nov 15, 2021
f990010
Make command/query controllers inherit from JsonApiController, passin…
Nov 9, 2021
61aa23e
Added overload on TypeExtensions.IsOrImplementsInterface to take a ty…
Nov 9, 2021
caa131e
Use ResourceType instead of public name in local-id tracker
Nov 17, 2021
0328293
Change IQueryStringParameterReader.AllowEmptyValue into normal interf…
Nov 18, 2021
d343c9d
Simplified startup in example project
Nov 18, 2021
760df70
Removed left-over overload with single type parameter in ResourceGrap…
Nov 18, 2021
93ac5f6
Various corrections in documentation, added #nullable where it makes …
Nov 18, 2021
2e9ca6a
Revert DocFx workaround
Nov 18, 2021
12b23bf
Updated version compatibility table
Nov 18, 2021
4b61bf7
Added release notes and icon to NuGet package
Nov 18, 2021
58ac1ec
Fix nullability warnings produced by .NET 6 with EF Core 6
Nov 18, 2021
6c5214d
Fixed: Error when using EagerLoad on a relationship
Nov 18, 2021
6546063
Use VS2022 image in AppVeyor on Windows
Nov 18, 2021
3fcb6f8
Fixed broken tests on EF Core 6
Nov 18, 2021
0140070
Fixed redacted data when running tests
Nov 18, 2021
2f0687d
Breaking: Removed access-control action filter attributes such as Htt…
Nov 19, 2021
1badb50
Increase version number, use branch name in suffix
Nov 19, 2021
b76629d
Pass the full resource to LinkBuilder, instead of just its ID. This a…
Nov 19, 2021
2802d23
Optimization: Only save when there are changes in a remove-from-to-ma…
Nov 19, 2021
745eacc
Clarifications in doc-comments
Nov 19, 2021
a79f90c
Extract constant
Nov 19, 2021
31f084e
Extract method
Nov 19, 2021
0182ce3
Cleanup SelectClauseBuilder.ToPropertySelectors
Nov 19, 2021
1b8bcb0
Since EF Core 5, SaveChanges automatically creates a savepoint and ro…
Nov 19, 2021
bcf1f18
Improved unittests for populating IJsonApiRequest in middleware
Nov 19, 2021
3fe49f4
Clarify intent in AtomicOperationObjectAdapter
Nov 20, 2021
622fddc
Review feedback: use `ResourceType resourceType` instead of `Resource…
Nov 22, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public override string ToString()
{
var builder = new StringBuilder();

foreach ((ResourceType resource, SparseFieldSetExpression fields) in Table)
foreach ((ResourceType resourceType, SparseFieldSetExpression fields) in Table)
{
if (builder.Length > 0)
{
builder.Append(',');
}

builder.Append(resource.PublicName);
builder.Append(resourceType.PublicName);
builder.Append('(');
builder.Append(fields);
builder.Append(')');
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Queries/IQueryLayerComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QueryLayer WrapLayerForSecondaryEndpoint<TId>(QueryLayer secondaryLayer, Resourc
/// Builds a query that retrieves the primary resource, including all of its attributes and all targeted relationships, during a create/update/delete
/// request.
/// </summary>
QueryLayer ComposeForUpdate<TId>(TId id, ResourceType primaryResource);
QueryLayer ComposeForUpdate<TId>(TId id, ResourceType primaryResourceType);

/// <summary>
/// Builds a query for each targeted relationship with a filter to match on its right resource IDs.
Expand Down
8 changes: 4 additions & 4 deletions src/JsonApiDotNetCore/Queries/Internal/QueryLayerComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,16 @@ private IncludeExpression RewriteIncludeForSecondaryEndpoint(IncludeExpression?
}

/// <inheritdoc />
public QueryLayer ComposeForUpdate<TId>(TId id, ResourceType primaryResource)
public QueryLayer ComposeForUpdate<TId>(TId id, ResourceType primaryResourceType)
{
ArgumentGuard.NotNull(primaryResource, nameof(primaryResource));
ArgumentGuard.NotNull(primaryResourceType, nameof(primaryResourceType));

IImmutableSet<IncludeElementExpression> includeElements = _targetedFields.Relationships
.Select(relationship => new IncludeElementExpression(relationship)).ToImmutableHashSet();

AttrAttribute primaryIdAttribute = GetIdAttribute(primaryResource);
AttrAttribute primaryIdAttribute = GetIdAttribute(primaryResourceType);

QueryLayer primaryLayer = ComposeTopLayer(Array.Empty<ExpressionInScope>(), primaryResource);
QueryLayer primaryLayer = ComposeTopLayer(Array.Empty<ExpressionInScope>(), primaryResourceType);
primaryLayer.Include = includeElements.Any() ? new IncludeExpression(includeElements) : IncludeExpression.Empty;
primaryLayer.Sort = null;
primaryLayer.Pagination = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public virtual void Read(string parameterName, StringValues parameterValue)

try
{
ResourceType targetResource = GetSparseFieldType(parameterName);
SparseFieldSetExpression sparseFieldSet = GetSparseFieldSet(parameterValue, targetResource);
ResourceType targetResourceType = GetSparseFieldType(parameterName);
SparseFieldSetExpression sparseFieldSet = GetSparseFieldSet(parameterValue, targetResourceType);

_sparseFieldTableBuilder[targetResource] = sparseFieldSet;
_sparseFieldTableBuilder[targetResourceType] = sparseFieldSet;
}
catch (QueryParseException exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ protected virtual ResourceObject ConvertResource(IIdentifiable resource, Resourc
return resourceObject;
}

protected virtual IDictionary<string, object?>? ConvertAttributes(IIdentifiable resource, ResourceType resourceType,
protected virtual IDictionary<string, object?>? ConvertAttributes(IIdentifiable resource, ResourceType type,
IImmutableSet<ResourceFieldAttribute> fieldSet)
{
var attrMap = new Dictionary<string, object?>(resourceType.Attributes.Count);
var attrMap = new Dictionary<string, object?>(type.Attributes.Count);

foreach (AttrAttribute attr in resourceType.Attributes)
foreach (AttrAttribute attr in type.Attributes)
{
if (!fieldSet.Contains(attr) || attr.Property.Name == nameof(Identifiable<object>.Id))
{
Expand Down