refactor(api): rm JB Annotations, simplify warning suppressions

This commit is contained in:
Collin Barrett 2025-05-27 18:15:10 -05:00 committed by Collin Barrett
parent cf98af22c9
commit d1dc35c7b5
12 changed files with 3 additions and 41 deletions

View file

@ -1,6 +1,5 @@
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;
using JetBrains.Annotations;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
@ -86,7 +85,6 @@ internal static class OpenApiTags
}
};
[UsedImplicitly]
internal sealed class TagDescriptionsDocumentFilter : IDocumentFilter
{
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)

View file

@ -3,14 +3,7 @@
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>1591;1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<NoWarn>1591;1701;1702</NoWarn>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -28,7 +27,6 @@ public static class GetLanguages
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -45,6 +43,5 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="Iso6391" example="en">The unique ISO 639-1 code.</param>
/// <param name="Name" example="English">The unique ISO name.</param>
/// <param name="FilterListIds" example="[ 114, 141 ]">The identifiers of the FilterLists targeted by this Language.</param>
[PublicAPI]
public sealed record Response(short Id, string Iso6391, string Name, IEnumerable<int> FilterListIds);
}

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -31,7 +30,6 @@ public static class GetLicenses
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -51,7 +49,6 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="PermitsDistribution" example="false">If the License permits distribution.</param>
/// <param name="PermitsCommercialUse" example="false">If the License permits commercial use.</param>
/// <param name="FilterListIds" example="[ 6, 31 ]">The identifiers of the FilterLists released under this License.</param>
[PublicAPI]
public sealed record Response(
int Id,
string Name,

View file

@ -1,5 +1,4 @@
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -71,7 +70,6 @@ public static class GetListDetails
public sealed record Request(int Id) : IRequest<Response?>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IRequestHandler<Request, Response?>
{
public Task<Response?> Handle(Request request, CancellationToken _)
@ -80,8 +78,7 @@ private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IRequestH
}
}
// TODO: refactor to primary ctor syntax while allowing EF Core query compilation to succeed
[PublicAPI]
// TODO: refactor to primary ctor syntax while allowing EF Core query compilation to succeed
public sealed record Response
{
/// <summary>
@ -238,6 +235,5 @@ public sealed record Response
/// unique per SegmentNumber)
/// </param>
/// <param name="Url" example="https://easylist.to/easylist/easylist.txt">The view URL.</param>
[PublicAPI]
public sealed record ViewUrlResponse(short SegmentNumber, short Primariness, Uri Url);
}

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -43,7 +42,6 @@ public static class GetLists
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -68,7 +66,6 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="TagIds" example="[ 2 ]">The identifiers of the Tags applied to this FilterList.</param>
/// <param name="PrimaryViewUrl" example="https://easylist.to/easylist/easylist.txt">The primary view URL.</param>
/// <param name="MaintainerIds" example="[ 7 ]">The identifiers of the Maintainers of this FilterList.</param>
[PublicAPI]
public sealed record Response(
int Id,
string Name,

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -30,7 +29,6 @@ public static class GetMaintainers
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -49,7 +47,6 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="EmailAddress" example="null">The email address.</param>
/// <param name="TwitterHandle" example="null">The Twitter handle.</param>
/// <param name="FilterListIds" example="[ 11, 13, 301 ]">The identifiers of the FilterLists maintained by this Maintainer.</param>
[PublicAPI]
public sealed record Response(
int Id,
string Name,

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -33,7 +32,6 @@ public static class GetSoftware
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -58,7 +56,6 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// If the Software supports the abp: URL scheme to click-to-subscribe to a FilterList.
/// </param>
/// <param name="SyntaxIds" example="[ 3, 28, 38, 48 ]">The identifiers of the Syntaxes that this Software supports.</param>
[PublicAPI]
public sealed record Response(
long Id,
string Name,

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -33,7 +32,6 @@ public static class GetSyntaxes
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -52,7 +50,6 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="Url" example="https://adblockplus.org/filters">The URL of the home page.</param>
/// <param name="FilterListIds" example="[ 2, 6, 11 ]">The identifiers of the FilterLists implementing this Syntax.</param>
/// <param name="SoftwareIds" example="[ 1, 2, 3 ]">The identifiers of the Software that supports this Syntax.</param>
[PublicAPI]
public sealed record Response(
short Id,
string Name,

View file

@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using FilterLists.Directory.Infrastructure;
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
using JetBrains.Annotations;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@ -29,7 +28,6 @@ public static class GetTags
public sealed record Request : IStreamRequest<Response>;
[UsedImplicitly]
private sealed class Handler(QueryDbContext ctx, IMemoryCache cache) : IStreamRequestHandler<Request, Response>
{
public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCancellation] CancellationToken ct)
@ -46,6 +44,5 @@ public async IAsyncEnumerable<Response> Handle(Request request, [EnumeratorCance
/// <param name="Name" example="ads">The unique name.</param>
/// <param name="Description" example="Blocks advertisements">The description.</param>
/// <param name="FilterListIds" example="[ 1, 3, 6 ]">The identifiers of the FilterLists to which this Tag is applied.</param>
[PublicAPI]
public sealed record Response(int Id, string Name, string? Description, IEnumerable<int> FilterListIds);
}

View file

@ -6,7 +6,6 @@
<ItemGroup>
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="8.2.2"/>
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
</ItemGroup>
</Project>

View file

@ -1,8 +1,5 @@
using JetBrains.Annotations;
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;
namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;
[PublicAPI]
public sealed record FilterListViewUrl
{
public int Id { get; init; }