Skip to content

Commit e8956b6

Browse files
committed
Fix new warnings
1 parent 8080e73 commit e8956b6

File tree

25 files changed

+54
-59
lines changed

25 files changed

+54
-59
lines changed

src/Examples/DapperExample/TranslationToSql/TreeNodes/TableSourceNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace DapperExample.TranslationToSql.TreeNodes;
77
/// </summary>
88
internal abstract class TableSourceNode(string? alias) : SqlTreeNode
99
{
10-
public const string IdColumnName = nameof(Identifiable<object>.Id);
10+
public const string IdColumnName = nameof(Identifiable<>.Id);
1111

1212
public abstract IReadOnlyList<ColumnNode> Columns { get; }
1313
public string? Alias { get; } = alias;

src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiActionDescriptorCollectionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private static void SetConsumes(ActionDescriptor descriptor, Type requestType, J
315315
string contentType = mediaType.ToString();
316316

317317
if (descriptor is ControllerActionDescriptor controllerActionDescriptor &&
318-
controllerActionDescriptor.MethodInfo.GetCustomAttributes(typeof(ConsumesAttribute)).Any())
318+
controllerActionDescriptor.MethodInfo.GetCustomAttributes<ConsumesAttribute>().Any())
319319
{
320320
// A custom JSON:API action method with [Consumes] on it. Hide the attribute from Swashbuckle, so it uses our data in API Explorer.
321321
controllerActionDescriptor.MethodInfo = new MethodInfoWrapper(controllerActionDescriptor.MethodInfo, [typeof(ConsumesAttribute)]);

src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/DocumentationOpenApiOperationFilter.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using JsonApiDotNetCore.Controllers;
66
using JsonApiDotNetCore.Middleware;
77
using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata.ActionMethods;
8-
using JsonApiDotNetCore.Resources;
98
using JsonApiDotNetCore.Resources.Annotations;
109
using Microsoft.AspNetCore.Mvc.ApiExplorer;
1110
using Microsoft.Net.Http.Headers;
@@ -19,15 +18,15 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents;
1918
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
2019
internal sealed class DocumentationOpenApiOperationFilter : IOperationFilter
2120
{
22-
private const string GetPrimaryName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetAsync);
23-
private const string GetSecondaryName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetSecondaryAsync);
24-
private const string GetRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetRelationshipAsync);
25-
private const string PostResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.PostAsync);
26-
private const string PostRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.PostRelationshipAsync);
27-
private const string PatchResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.PatchAsync);
28-
private const string PatchRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.PatchRelationshipAsync);
29-
private const string DeleteResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.DeleteAsync);
30-
private const string DeleteRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.DeleteRelationshipAsync);
21+
private const string GetPrimaryName = nameof(BaseJsonApiController<,>.GetAsync);
22+
private const string GetSecondaryName = nameof(BaseJsonApiController<,>.GetSecondaryAsync);
23+
private const string GetRelationshipName = nameof(BaseJsonApiController<,>.GetRelationshipAsync);
24+
private const string PostResourceName = nameof(BaseJsonApiController<,>.PostAsync);
25+
private const string PostRelationshipName = nameof(BaseJsonApiController<,>.PostRelationshipAsync);
26+
private const string PatchResourceName = nameof(BaseJsonApiController<,>.PatchAsync);
27+
private const string PatchRelationshipName = nameof(BaseJsonApiController<,>.PatchRelationshipAsync);
28+
private const string DeleteResourceName = nameof(BaseJsonApiController<,>.DeleteAsync);
29+
private const string DeleteRelationshipName = nameof(BaseJsonApiController<,>.DeleteRelationshipAsync);
3130
private const string PostOperationsName = nameof(BaseJsonApiOperationsController.PostOperationsAsync);
3231

3332
private const string TextCompareETag =

src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private List<DataProperty> GetDataPropertiesThatExistInResourceClrType(Type reso
6363

6464
foreach (DataProperty? property in dataContract.ObjectProperties)
6565
{
66-
if (property.MemberInfo.Name == nameof(Identifiable<object>.Id))
66+
if (property.MemberInfo.Name == nameof(Identifiable<>.Id))
6767
{
6868
// Schemas of JsonApiDotNetCore resources will obtain an Id property through inheritance of a resource identifier type.
6969
continue;

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ public interface IJsonApiOptions
175175
/// </summary>
176176
IsolationLevel? TransactionIsolationLevel { get; }
177177

178+
// ReSharper disable once InvalidXmlDocComment
179+
// Justification: Temporary workaround for Resharper bug at https://youtrack.jetbrains.com/issue/RSRP-501671.
178180
/// <summary>
179181
/// Lists the JSON:API extensions that are turned on. Empty by default, but if your project contains a controller that derives from
180182
/// <see cref="BaseJsonApiOperationsController" />, the <see cref="JsonApiMediaTypeExtension.AtomicOperations" /> and

src/JsonApiDotNetCore/Configuration/JsonApiValidationFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private IServiceProvider GetScopedServiceProvider()
6161

6262
private static bool IsId(string key)
6363
{
64-
return key == nameof(Identifiable<object>.Id) || key.EndsWith($".{nameof(Identifiable<object>.Id)}", StringComparison.Ordinal);
64+
return key == nameof(Identifiable<>.Id) || key.EndsWith($".{nameof(Identifiable<>.Id)}", StringComparison.Ordinal);
6565
}
6666

6767
private static bool IsAtPrimaryEndpoint(IJsonApiRequest request)

src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ private Dictionary<string, AttrAttribute>.ValueCollection GetAttributes(Type res
299299

300300
if (attribute == null)
301301
{
302-
if (property.Name == nameof(Identifiable<object>.Id))
302+
if (property.Name == nameof(Identifiable<>.Id))
303303
{
304304
// Although strictly not correct, 'id' is added to the list of attributes for convenience.
305305
// For example, it enables to filter on ID, without the need to special-case existing logic.

src/JsonApiDotNetCore/Errors/InvalidModelStateException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static List<ErrorObject> FromModelStateDictionary(IReadOnlyDictionary<st
134134

135135
private static string? ResolveSourcePointerInAttribute(PropertySegment segment, AttrAttribute attribute, IResourceGraph resourceGraph)
136136
{
137-
string sourcePointer = attribute.Property.Name == nameof(Identifiable<object>.Id)
137+
string sourcePointer = attribute.Property.Name == nameof(Identifiable<>.Id)
138138
? $"{segment.SourcePointer ?? "/data"}/{attribute.PublicName}"
139139
: $"{segment.SourcePointer ?? "/data"}/attributes/{attribute.PublicName}";
140140

src/JsonApiDotNetCore/Queries/Parsing/FilterParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ protected virtual ConstantValueConverter GetConstantValueConverterForType(Type d
539539

540540
private ConstantValueConverter GetConstantValueConverterForAttribute(AttrAttribute attribute)
541541
{
542-
if (attribute is { Property.Name: nameof(Identifiable<object>.Id) })
542+
if (attribute is { Property.Name: nameof(Identifiable<>.Id) })
543543
{
544544
return (stringValue, position) =>
545545
{

src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,6 @@ protected virtual PaginationExpression GetPagination(IReadOnlyCollection<QueryEx
620620

621621
private static AttrAttribute GetIdAttribute(ResourceType resourceType)
622622
{
623-
return resourceType.GetAttributeByPropertyName(nameof(Identifiable<object>.Id));
623+
return resourceType.GetAttributeByPropertyName(nameof(Identifiable<>.Id));
624624
}
625625
}

0 commit comments

Comments
 (0)