Skip to content

Commit

Permalink
remove newtonsoft package, clean nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
stasput committed Nov 15, 2024
1 parent 636ea27 commit f0db6cc
Show file tree
Hide file tree
Showing 21 changed files with 123 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
<PackageReference Include="SkbKontur.TypeScript.ContractGenerator" Version="2.0.131" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Text.Json.Serialization;
#nullable enable

using System.Text.Json.Serialization;

using SkbKontur.Cassandra.DistributedTaskQueue.Cassandra.Entities;

Expand All @@ -9,14 +11,12 @@ public class RtqMonitoringSearchRequest
[JsonPropertyName("enqueueTimestampRange")]
public TimestampRange EnqueueTimestampRange { get; set; }

Check warning on line 12 in Cassandra.DistributedTaskQueue.Monitoring/Api/RtqMonitoringSearchRequest.cs

View workflow job for this annotation

GitHub Actions / test (6.8.20)

Non-nullable property 'EnqueueTimestampRange' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 12 in Cassandra.DistributedTaskQueue.Monitoring/Api/RtqMonitoringSearchRequest.cs

View workflow job for this annotation

GitHub Actions / test (7.17.4)

Non-nullable property 'EnqueueTimestampRange' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

#nullable enable
[JsonPropertyName("queryString")]
public string? QueryString { get; set; }

[JsonPropertyName("states")]
public TaskState[]? States { get; set; }

#nullable disable
[JsonPropertyName("names")]
public string[] Names { get; set; }

Check warning on line 21 in Cassandra.DistributedTaskQueue.Monitoring/Api/RtqMonitoringSearchRequest.cs

View workflow job for this annotation

GitHub Actions / test (6.8.20)

Non-nullable property 'Names' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 21 in Cassandra.DistributedTaskQueue.Monitoring/Api/RtqMonitoringSearchRequest.cs

View workflow job for this annotation

GitHub Actions / test (7.17.4)

Non-nullable property 'Names' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public class RtqMonitoringSearchResults
[JsonPropertyName("totalCount")]
public long TotalCount { get; set; }

#nullable disable
[JsonPropertyName("taskMetas")]
public RtqMonitoringTaskMeta[] TaskMetas { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

using SkbKontur.Cassandra.DistributedTaskQueue.Cassandra.Entities;
using SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

using SkbKontur.Cassandra.DistributedTaskQueue.Handling;
using SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

using SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.Json;
using SkbKontur.Cassandra.TimeBasedUuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="Elasticsearch.Net" Version="7.17.5" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SkbKontur.EventFeeds" Version="1.1.3" />
<PackageReference Include="System.Text.Json" Version="9.0.0-rc.2.24473.5" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System;
using System;
using System.Linq;
using System.Text;
using System.Text.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

using SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System;
using System;
using System.Text.Json;

using Elasticsearch.Net;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using System.Collections.Generic;
#nullable enable

using System.Collections.Generic;
using System.Linq;

using SkbKontur.Cassandra.DistributedTaskQueue.Cassandra.Entities;

#nullable enable
namespace SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.TaskCounter;

namespace SkbKontur.Cassandra.DistributedTaskQueue.Monitoring.TaskCounter
public class RtqTaskCounters
{
public class RtqTaskCounters
{
public int LostTasksCount { get; set; }
public int LostTasksCount { get; set; }

public Dictionary<TaskState, int> PendingTaskCountsTotal { get; set; } = null!;
public Dictionary<TaskState, int> PendingTaskCountsTotal { get; set; } = null!;

public Dictionary<(string TaskName, string TaskTopic), Dictionary<TaskState, int>> PendingTaskCountsByNameAndTopic { get; set; } = null!;
public Dictionary<(string TaskName, string TaskTopic), Dictionary<TaskState, int>> PendingTaskCountsByNameAndTopic { get; set; } = null!;

public int GetPendingTaskTotalCount()
{
return PendingTaskCountsTotal.Values.Sum();
}
public int GetPendingTaskTotalCount()
{
return PendingTaskCountsTotal.Values.Sum();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<OutputPath>bin\</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cassandra.DistributedTaskQueue.FunctionalTests.Common\Cassandra.DistributedTaskQueue.FunctionalTests.Common.csproj" />
</ItemGroup>
Expand Down
27 changes: 13 additions & 14 deletions Cassandra.DistributedTaskQueue.TestExchangeService/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace SkbKontur.Cassandra.DistributedTaskQueue.TestExchangeService
namespace SkbKontur.Cassandra.DistributedTaskQueue.TestExchangeService;

public class Startup
{
public class Startup
public void ConfigureServices(IServiceCollection services)
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddNewtonsoftJson();
services.AddSingleton<IControllerFactory>(new GroboControllerFactory());
}
services.AddControllers();
services.AddSingleton<IControllerFactory>(new GroboControllerFactory());
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();

app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapControllers());
}
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapControllers());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable disable

using System;
using System;
using System.Text;
using System.Text.Json;

Expand Down
19 changes: 9 additions & 10 deletions Cassandra.DistributedTaskQueue.Tests/RtqTaskCountersForTests.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#nullable enable

using System.Collections.Generic;
using System.Linq;

using SkbKontur.Cassandra.DistributedTaskQueue.Cassandra.Entities;

#nullable enable
namespace SkbKontur.Cassandra.DistributedTaskQueue.Tests;

namespace SkbKontur.Cassandra.DistributedTaskQueue.Tests
public class RtqTaskCountersForTests
{
public class RtqTaskCountersForTests
{
public int LostTasksCount { get; set; }
public int LostTasksCount { get; set; }

public Dictionary<TaskState, int> PendingTaskCountsTotal { get; set; } = null!;
public Dictionary<TaskState, int> PendingTaskCountsTotal { get; set; } = null!;

public int GetPendingTaskTotalCount()
{
return PendingTaskCountsTotal.Values.Sum();
}
public int GetPendingTaskTotalCount()
{
return PendingTaskCountsTotal.Values.Sum();
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using System;
#nullable enable

#nullable enable
using System;

namespace SkbKontur.Cassandra.DistributedTaskQueue.Configuration
namespace SkbKontur.Cassandra.DistributedTaskQueue.Configuration;

public interface IRtqTaskDataRegistry
{
public interface IRtqTaskDataRegistry
{
string[] GetAllTaskNames();
string[] GetAllTaskNames();

string GetTaskName(Type type);
string GetTaskName(Type type);

Type GetTaskType(string taskName);
Type GetTaskType(string taskName);

bool TryGetTaskType(string taskName, out Type? taskType);
bool TryGetTaskType(string taskName, out Type? taskType);

string[] GetAllTaskTopics();
string[] GetAllTaskTopics();

(string TaskName, string TopicName)[] GetAllTaskNamesWithTopics();
(string TaskName, string TopicName)[] GetAllTaskNamesWithTopics();

string GetTaskTopic(string taskName);
}
string GetTaskTopic(string taskName);
}
Loading

0 comments on commit f0db6cc

Please sign in to comment.