Skip to content

Nullable reference types #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
10939b0
Renamed TryXXX resource graph lookup methods to FindXXX, throwing on …
Oct 12, 2021
27ab8e0
Added directive to disable NRT in all source files
Oct 11, 2021
6cc336c
Turn on NRT globally
Oct 11, 2021
0f01b9d
Annotated JsonApiDotNetCore library
Oct 11, 2021
49fcacc
Use alternate public name for attribute, to improve test coverage
Oct 14, 2021
a376207
Annotated example projects
Oct 13, 2021
3319059
Annotated benchmark project
Oct 13, 2021
9a97132
Enhanced rendering of error.source.pointer on ModelState validation e…
Oct 15, 2021
11034f1
Respect configured MaxModelValidationErrors in operations
Oct 18, 2021
534e635
Added docs for nullable reference types
Oct 18, 2021
9003eda
Automated cleanup code
Oct 18, 2021
33f5258
Fixed: do not fail when clearing a required to-many relationship
Oct 27, 2021
5da9d5d
Annotated controllers in integration tests
Oct 18, 2021
3c3aa4f
Annotated DbContexts in integration tests
Oct 18, 2021
9ade804
Annotated fakers in integration tests
Oct 18, 2021
72572ed
Annotated TestBuildingBlocks
Oct 19, 2021
90891c8
Use Should() replacements that flow nullability
Oct 19, 2021
268bc6c
Re-align similar testsets
Oct 19, 2021
0ab9403
Annotated test projects, use fakers for non-trivial models in integra…
Oct 28, 2021
6fc7825
Fixed: make faker dates deterministic
Oct 31, 2021
6becd1f
Enable ASP.NET ModelState validation by default
Oct 31, 2021
b643c06
Check off roadmap entry
Oct 31, 2021
337c093
Documented required one-to-one relationships mapping
Oct 31, 2021
fc1a719
Added missing HEAD routes
Oct 31, 2021
d45ebdd
Prefer IDictionary<,>.TryGetValue() over .Contains() followed by inde…
Oct 31, 2021
1a57ea0
Optimized response rendering time when no sparse fieldset is requeste…
Oct 31, 2021
a1dcf87
Fixed: handle nulls in request body
Oct 31, 2021
cc45e15
Workaround for crash in cibuild
Nov 1, 2021
e444e96
Update to latest JetBrains tools
Nov 1, 2021
8002a53
Package updates
Nov 2, 2021
4f23fc2
Review non-public TryXXX methods
Nov 2, 2021
bb426c6
Addressed review feedback
Nov 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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": "2021.1.4",
"version": "2021.2.2",
"commands": [
"jb"
]
Expand Down
2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function CheckLastExitCode {

function RunInspectCode {
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
dotnet jb inspectcode JsonApiDotNetCore.sln --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal
dotnet jb inspectcode JsonApiDotNetCore.sln --no-build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal
CheckLastExitCode

[xml]$xml = Get-Content "$outputPath"
Expand Down
2 changes: 1 addition & 1 deletion CSharpGuidelinesAnalyzer.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<cSharpGuidelinesAnalyzerSettings>
<setting rule="AV1561" name="MaxParameterCount" value="6" />
<setting rule="AV1561" name="MaxConstructorParameterCount" value="12" />
<setting rule="AV1561" name="MaxConstructorParameterCount" value="13" />
</cSharpGuidelinesAnalyzerSettings>
7 changes: 4 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
<NpgsqlPostgreSQLVersion>5.0.*</NpgsqlPostgreSQLVersion>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
<WarningLevel>9999</WarningLevel>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.7.0" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
</ItemGroup>
Expand All @@ -24,9 +25,9 @@
<PropertyGroup>
<BogusVersion>33.1.1</BogusVersion>
<CoverletVersion>3.1.0</CoverletVersion>
<FluentAssertionsVersion>6.1.0</FluentAssertionsVersion>
<FluentAssertionsVersion>6.2.0</FluentAssertionsVersion>
<MoqVersion>4.16.1</MoqVersion>
<XUnitVersion>2.4.*</XUnitVersion>
<TestSdkVersion>16.11.0</TestSdkVersion>
<TestSdkVersion>17.0.0</TestSdkVersion>
</PropertyGroup>
</Project>
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public class Startup
The following chart should help you pick the best version, based on your environment.
See also our [versioning policy](./VERSIONING_POLICY.md).

| .NET version | EF Core version | JsonApiDotNetCore version |
| ------------ | --------------- | ------------------------- |
| Core 2.x | 2.x | 3.x |
| Core 3.1 | 3.1 | 4.x |
| Core 3.1 | 5 | 4.x |
| 5 | 5 | 4.x or 5.x |
| 6 | 6 | 5.x |
| .NET version | Entity Framework Core version | JsonApiDotNetCore version |
| ------------ | ----------------------------- | ------------------------- |
| Core 2.x | 2.x | 3.x |
| Core 3.1 | 3.1 | 4.x |
| Core 3.1 | 5 | 4.x |
| 5 | 5 | 4.x or 5.x |
| 6 | 6 | 5.x |

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The need for breaking changes has blocked several efforts in the v4.x release, s
- [x] Optimized delete to-many [#1030](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1030)
- [x] Support System.Text.Json [#664](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/664) [#999](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/999) [1077](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1077) [1078](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1078)
- [x] Optimize IIdentifiable to ResourceObject conversion [#1028](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1028) [#1024](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1024) [#233](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/233)
- [ ] Nullable reference types [#1029](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1029)
- [x] Nullable reference types [#1029](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1029)

Aside from the list above, we have interest in the following topics. It's too soon yet to decide whether they'll make it into v5.x or in a later major version.

Expand Down
16 changes: 0 additions & 16 deletions benchmarks/BenchmarkResource.cs

This file was deleted.

10 changes: 0 additions & 10 deletions benchmarks/BenchmarkResourcePublicNames.cs

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
</ItemGroup>
</Project>
18 changes: 0 additions & 18 deletions benchmarks/DependencyFactory.cs

This file was deleted.

30 changes: 16 additions & 14 deletions benchmarks/Deserialization/DeserializationBenchmarkBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class DeserializationBenchmarkBase
protected DeserializationBenchmarkBase()
{
var options = new JsonApiOptions();
IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<ResourceA>().Build();
IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<IncomingResource>().Build();
options.SerializerOptions.Converters.Add(new ResourceObjectConverter(resourceGraph));
SerializerReadOptions = ((IJsonApiOptions)options).SerializerReadOptions;

Expand All @@ -30,7 +30,9 @@ protected DeserializationBenchmarkBase()
var resourceDefinitionAccessor = new ResourceDefinitionAccessor(resourceGraph, serviceContainer);

serviceContainer.AddService(typeof(IResourceDefinitionAccessor), resourceDefinitionAccessor);
serviceContainer.AddService(typeof(IResourceDefinition<ResourceA, int>), new JsonApiResourceDefinition<ResourceA, int>(resourceGraph));

serviceContainer.AddService(typeof(IResourceDefinition<IncomingResource, int>),
new JsonApiResourceDefinition<IncomingResource, int>(resourceGraph));

// ReSharper disable once VirtualMemberCallInConstructor
JsonApiRequest request = CreateJsonApiRequest(resourceGraph);
Expand All @@ -56,7 +58,7 @@ protected DeserializationBenchmarkBase()
protected abstract JsonApiRequest CreateJsonApiRequest(IResourceGraph resourceGraph);

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public sealed class ResourceA : Identifiable<int>
public sealed class IncomingResource : Identifiable<int>
{
[Attr]
public bool Attribute01 { get; set; }
Expand All @@ -74,7 +76,7 @@ public sealed class ResourceA : Identifiable<int>
public float? Attribute05 { get; set; }

[Attr]
public string Attribute06 { get; set; }
public string Attribute06 { get; set; } = null!;

[Attr]
public DateTime? Attribute07 { get; set; }
Expand All @@ -89,34 +91,34 @@ public sealed class ResourceA : Identifiable<int>
public DayOfWeek Attribute10 { get; set; }

[HasOne]
public ResourceA Single1 { get; set; }
public IncomingResource Single1 { get; set; } = null!;

[HasOne]
public ResourceA Single2 { get; set; }
public IncomingResource Single2 { get; set; } = null!;

[HasOne]
public ResourceA Single3 { get; set; }
public IncomingResource Single3 { get; set; } = null!;

[HasOne]
public ResourceA Single4 { get; set; }
public IncomingResource Single4 { get; set; } = null!;

[HasOne]
public ResourceA Single5 { get; set; }
public IncomingResource Single5 { get; set; } = null!;

[HasMany]
public ISet<ResourceA> Multi1 { get; set; }
public ISet<IncomingResource> Multi1 { get; set; } = null!;

[HasMany]
public ISet<ResourceA> Multi2 { get; set; }
public ISet<IncomingResource> Multi2 { get; set; } = null!;

[HasMany]
public ISet<ResourceA> Multi3 { get; set; }
public ISet<IncomingResource> Multi3 { get; set; } = null!;

[HasMany]
public ISet<ResourceA> Multi4 { get; set; }
public ISet<IncomingResource> Multi4 { get; set; } = null!;

[HasMany]
public ISet<ResourceA> Multi5 { get; set; }
public ISet<IncomingResource> Multi5 { get; set; } = null!;
}
}
}
Loading