Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2025.3.4",
"version": "2026.1.0.1",
"commands": [
"jb"
],
Expand Down
63 changes: 34 additions & 29 deletions JsonApiDotNetCore.slnx.DotSettings

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private void AppendOnNewLine(string? value, StringBuilder builder)
builder.AppendLine();
}

builder.Append(new string(' ', _indentDepth * 4));
builder.Append(' ', _indentDepth * 4);
builder.Append(value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AddToRelationshipProcessor(IAddToRelationshipService<TResource, TId> serv
var leftId = (TId)operation.Resource.GetTypedId();
ISet<IIdentifiable> rightResourceIds = operation.GetSecondaryResources();

await _service.AddToToManyRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken);
await _service.AddToToManyRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken);

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public DeleteProcessor(IDeleteService<TResource, TId> service)
ArgumentNullException.ThrowIfNull(operation);

var id = (TId)operation.Resource.GetTypedId();
#pragma warning disable CS8607 // A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]
// Justification: Temporary workaround for R# bug at https://youtrack.jetbrains.com/issue/RSRP-503026.
await _service.DeleteAsync(id, cancellationToken);
#pragma warning restore CS8607 // A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public RemoveFromRelationshipProcessor(IRemoveFromRelationshipService<TResource,
var leftId = (TId)operation.Resource.GetTypedId();
ISet<IIdentifiable> rightResourceIds = operation.GetSecondaryResources();

await _service.RemoveFromToManyRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken);
await _service.RemoveFromToManyRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken);

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public SetRelationshipProcessor(ISetRelationshipService<TResource, TId> service)
var leftId = (TId)operation.Resource.GetTypedId();
object? rightValue = GetRelationshipRightValue(operation);

await _service.SetRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightValue, cancellationToken);
await _service.SetRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightValue, cancellationToken);

return null;
}
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 @@ -263,7 +263,7 @@ private void WriteResult(StringBuilder builder, int indent, TimeSpan timeElapsed

private static void WriteIndent(StringBuilder builder, int indent)
{
builder.Append(new string(' ', indent * 2));
builder.Append(' ', indent * 2);
}

private void WritePadding(StringBuilder builder, int indent, int paddingLength)
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task InvokeAsync(HttpContext httpContext, IJsonApiRequest request)
if (CodeTimingSessionManager.IsEnabled && _logger.IsEnabled(LogLevel.Information))
{
string timingResults = CodeTimingSessionManager.Current.GetResults();
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, "");
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty);
string requestUrl = httpContext.Request.GetEncodedUrl();
LogMeasurement(requestMethod, requestUrl, Environment.NewLine, timingResults);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override string ToString()

public override string ToFullString()
{
return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : "")}";
return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : string.Empty)}";
}

public override bool Equals(object? obj)
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Queries/IndentingStringWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public void WriteLine(string? line)
{
if (_indentDepth > 0)
{
_builder.Append(new string(' ', _indentDepth * 2));
_builder.Append(' ', _indentDepth * 2);
}

_builder.AppendLine(line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public JsonApiReader(IJsonApiOptions options, IDocumentAdapter documentAdapter,

if (_logger.IsEnabled(LogLevel.Trace))
{
string requestMethod = httpRequest.Method.Replace(Environment.NewLine, "");
string requestMethod = httpRequest.Method.Replace(Environment.NewLine, string.Empty);
string requestUrl = httpRequest.GetEncodedUrl();
LogRequest(requestMethod, requestUrl, requestBody);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task WriteAsync(object? model, HttpContext httpContext)

if (_logger.IsEnabled(LogLevel.Trace))
{
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, "");
string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty);
string requestUrl = httpContext.Request.GetEncodedUrl();
LogResponse(requestMethod, requestUrl, responseBody, httpContext.Response.StatusCode);
}
Expand Down
10 changes: 5 additions & 5 deletions test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Can_add_resources_from_assembly_to_graph()
Action<ServiceDiscoveryFacade> addAction = facade => facade.AddAssembly(typeof(Person).Assembly);

// Act
_services.AddJsonApi(discovery: facade => addAction(facade));
_services.AddJsonApi(discovery: addAction);

// Assert
ServiceProvider serviceProvider = _services.BuildServiceProvider();
Expand All @@ -49,7 +49,7 @@ public void Can_add_resource_from_current_assembly_to_graph()
Action<ServiceDiscoveryFacade> addAction = facade => facade.AddCurrentAssembly();

// Act
_services.AddJsonApi(discovery: facade => addAction(facade));
_services.AddJsonApi(discovery: addAction);

// Assert
ServiceProvider serviceProvider = _services.BuildServiceProvider();
Expand All @@ -66,7 +66,7 @@ public void Can_add_resource_service_from_current_assembly_to_container()
Action<ServiceDiscoveryFacade> addAction = facade => facade.AddCurrentAssembly();

// Act
_services.AddJsonApi(discovery: facade => addAction(facade));
_services.AddJsonApi(discovery: addAction);

// Assert
ServiceProvider serviceProvider = _services.BuildServiceProvider();
Expand All @@ -82,7 +82,7 @@ public void Can_add_resource_repository_from_current_assembly_to_container()
Action<ServiceDiscoveryFacade> addAction = facade => facade.AddCurrentAssembly();

// Act
_services.AddJsonApi(discovery: facade => addAction(facade));
_services.AddJsonApi(discovery: addAction);

// Assert
ServiceProvider serviceProvider = _services.BuildServiceProvider();
Expand All @@ -98,7 +98,7 @@ public void Can_add_resource_definition_from_current_assembly_to_container()
Action<ServiceDiscoveryFacade> addAction = facade => facade.AddCurrentAssembly();

// Act
_services.AddJsonApi(discovery: facade => addAction(facade));
_services.AddJsonApi(discovery: addAction);

// Assert
ServiceProvider serviceProvider = _services.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ public async Task Can_sort_on_multiple_fields_in_multiple_scopes()
blogs[0].Posts[1].Caption = "A";
blogs[0].Posts[2].Caption = "A";
blogs[0].Posts[3].Caption = "C";
blogs[0].Posts[0].Url = "";
blogs[0].Posts[0].Url = string.Empty;
blogs[0].Posts[1].Url = "www.some2.com";
blogs[0].Posts[2].Url = "www.some1.com";
blogs[0].Posts[3].Url = "";
blogs[0].Posts[3].Url = string.Empty;

blogs[0].Posts[0].Comments = _fakers.Comment.GenerateSet(3);
blogs[0].Posts[0].Comments.ElementAt(0).CreatedAt = 1.January(2015).AsUtc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void Reader_Read_Pagination_Succeeds(string? pageNumber, string? pageSize
ResourceFieldChainExpression?[] scopeTrees = constraints.Select(expressionInScope => expressionInScope.Scope).ToArray();

scopeTrees.Should().HaveSameCount(scopeTreesExpectedArray);
scopeTrees.Select(tree => tree?.ToString() ?? "").Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering());
scopeTrees.Select(tree => tree?.ToString() ?? string.Empty).Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering());

string[] valueTreesExpectedArray = valueTreesExpected.Split("|");
QueryExpression[] valueTrees = constraints.Select(expressionInScope => expressionInScope.Expression).ToArray();
Expand Down
2 changes: 1 addition & 1 deletion test/TestBuildingBlocks/XUnitLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private static string GetLogLevelString(LogLevel logLevel)
LogLevel.Warning => "WARN",
LogLevel.Error => "FAIL",
LogLevel.Critical => "CRIT",
LogLevel.None => "",
LogLevel.None => string.Empty,
_ => throw new ArgumentOutOfRangeException(nameof(logLevel))
};
}
Expand Down
Loading