Skip to content
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

COM Hardware: Make (string) property Bezeichnung explicitly nullable #496

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BO4E/COM/Hardware.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System.Text.Json.Serialization;
using BO4E.ENUM;
using BO4E.meta;
@@ -20,7 +21,7 @@ public class Hardware : COM
[JsonProperty(PropertyName = "bezeichnung", Required = Required.Always)]
[JsonPropertyName("bezeichnung")]
[ProtoMember(4)]
public string Bezeichnung { get; set; }
public string? Bezeichnung { get; set; }

/// <summary>Bezeichnung der Hardware.</summary>
[JsonProperty(PropertyName = "geraeteeigenschaften", Required = Required.Default)]

Unchanged files with check annotations Beta

private readonly JsonSerializerOptions _options = new()
{
Converters = { new JsonStringEnumConverter() },
IgnoreNullValues = true

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / pushfeature

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / pushfeature

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / pushfeature

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (6.0.201)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (7.0.100)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (8.0.100)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (6.0.201)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (7.0.100)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)

Check warning on line 22 in BO4ETestProject/TestSperrauftrag.cs

GitHub Actions / unittest (8.0.100)

'JsonSerializerOptions.IgnoreNullValues' is obsolete: 'JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.' (https://aka.ms/dotnet-warnings/SYSLIB0020)
};
[TestMethod]
public void Test_Mehrmindermengenabrechnung_System_Text()
{
var options = LenientParsing.MOST_LENIENT.GetJsonSerializerOptions();
var myLegacyInstance = new MyClass() { Verwendungszweck = Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG };

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (6.0.201)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (7.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (8.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (6.0.201)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (7.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 52 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (8.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'
var myLegacyJson = System.Text.Json.JsonSerializer.Serialize(myLegacyInstance, options);
myLegacyJson.Should().Contain("MEHRMINDERMBENGENABRECHNUNG").And.Contain("B"); // note the "B"
var myNewInstance = System.Text.Json.JsonSerializer.Deserialize<MyClass>(myLegacyJson, options);
{
var options = LenientParsing.MOST_LENIENT.GetJsonSerializerSettings();
options.Converters.Add(new StringEnumConverter());
var myLegacyInstance = new MyClass() { Verwendungszweck = Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG };

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / pushfeature

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (6.0.201)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (7.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (8.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (6.0.201)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (7.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'

Check warning on line 65 in BO4ETestProject/TestEnumMembers.cs

GitHub Actions / unittest (8.0.100)

'Verwendungszweck.MEHRMINDERMBENGENABRECHNUNG' is obsolete: 'This is only to keep the library backwards compatible'
var myLegacyJson = Newtonsoft.Json.JsonConvert.SerializeObject(myLegacyInstance, options);
myLegacyJson.Should().Contain("MEHRMINDERMBENGENABRECHNUNG").And.Contain("B"); // note the "B"
var myNewInstance = Newtonsoft.Json.JsonConvert.DeserializeObject<MyClass>(myLegacyJson, options);
// BusinessObjects
typeof(Auftrag),
typeof(AuftragsStorno),

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (6.0.201)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (7.0.100)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (8.0.100)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (6.0.201)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (7.0.100)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 47 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (8.0.100)

'AuftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'
typeof(Avis),
typeof(Benachrichtigung),
typeof(Berechnungsformel),
typeof(PreisblattUmlagen),
typeof(Region),
typeof(Sperrauftrag),
typeof(SperrauftragsStorno),

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / pushfeature

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (6.0.201)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (7.0.100)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (8.0.100)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (6.0.201)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (7.0.100)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'

Check warning on line 62 in BO4ETestProject/TestJsonOrder.cs

GitHub Actions / unittest (8.0.100)

'SperrauftragsStorno' is obsolete: 'This is not used in the implementation of the blocking process - we use the enum Auftragsstornogrund instead'
// COMponents
typeof(Abweichung),