Skip to content

Commit 3ff6583

Browse files
committed
Fix IDE0340: Use unbound generic type
1 parent 6de8ade commit 3ff6583

File tree

20 files changed

+38
-41
lines changed

20 files changed

+38
-41
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/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;
@@ -18,15 +17,15 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents;
1817
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
1918
internal sealed class DocumentationOpenApiOperationFilter : IOperationFilter
2019
{
21-
private const string GetPrimaryName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetAsync);
22-
private const string GetSecondaryName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetSecondaryAsync);
23-
private const string GetRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.GetRelationshipAsync);
24-
private const string PostResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.PostAsync);
25-
private const string PostRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.PostRelationshipAsync);
26-
private const string PatchResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.PatchAsync);
27-
private const string PatchRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.PatchRelationshipAsync);
28-
private const string DeleteResourceName = nameof(BaseJsonApiController<Identifiable<int>, int>.DeleteAsync);
29-
private const string DeleteRelationshipName = nameof(BaseJsonApiController<Identifiable<int>, int>.DeleteRelationshipAsync);
20+
private const string GetPrimaryName = nameof(BaseJsonApiController<,>.GetAsync);
21+
private const string GetSecondaryName = nameof(BaseJsonApiController<,>.GetSecondaryAsync);
22+
private const string GetRelationshipName = nameof(BaseJsonApiController<,>.GetRelationshipAsync);
23+
private const string PostResourceName = nameof(BaseJsonApiController<,>.PostAsync);
24+
private const string PostRelationshipName = nameof(BaseJsonApiController<,>.PostRelationshipAsync);
25+
private const string PatchResourceName = nameof(BaseJsonApiController<,>.PatchAsync);
26+
private const string PatchRelationshipName = nameof(BaseJsonApiController<,>.PatchRelationshipAsync);
27+
private const string DeleteResourceName = nameof(BaseJsonApiController<,>.DeleteAsync);
28+
private const string DeleteRelationshipName = nameof(BaseJsonApiController<,>.DeleteRelationshipAsync);
3029
private const string PostOperationsName = nameof(BaseJsonApiOperationsController.PostOperationsAsync);
3130

3231
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/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
@@ -540,7 +540,7 @@ protected virtual ConstantValueConverter GetConstantValueConverterForType(Type d
540540

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

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
}

src/JsonApiDotNetCore/Queries/SparseFieldSetCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public IImmutableSet<AttrAttribute> GetIdAttributeSetForRelationshipQuery(Resour
9494
{
9595
ArgumentNullException.ThrowIfNull(resourceType);
9696

97-
AttrAttribute idAttribute = resourceType.GetAttributeByPropertyName(nameof(Identifiable<object>.Id));
97+
AttrAttribute idAttribute = resourceType.GetAttributeByPropertyName(nameof(Identifiable<>.Id));
9898
var inputExpression = new SparseFieldSetExpression(ImmutableHashSet.Create<ResourceFieldAttribute>(idAttribute));
9999

100100
// Intentionally not cached, as we are fetching ID only (ignoring any sparse fieldset that came from query string).

src/JsonApiDotNetCore/QueryStrings/SparseFieldSetQueryStringParameterReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private SparseFieldSetExpression GetSparseFieldSet(string parameterValue, Resour
8585
if (sparseFieldSet == null)
8686
{
8787
// We add ID to an incoming empty fieldset, so that callers can distinguish between no fieldset and an empty one.
88-
AttrAttribute idAttribute = resourceType.GetAttributeByPropertyName(nameof(Identifiable<object>.Id));
88+
AttrAttribute idAttribute = resourceType.GetAttributeByPropertyName(nameof(Identifiable<>.Id));
8989
return new SparseFieldSetExpression(ImmutableHashSet.Create<ResourceFieldAttribute>(idAttribute));
9090
}
9191

0 commit comments

Comments
 (0)