From 8abea1ab09889fc4562e4baa1e6c31d2d1f77fa7 Mon Sep 17 00:00:00 2001 From: Christopher Mann Date: Mon, 2 Dec 2024 13:21:00 +0100 Subject: [PATCH] Fix support for flat networks (#94) * Update REST API client to fix incorrect nullability --- .../EryphComputeClientModelFactory.cs | 26 ------------------- .../Models/VirtualNetwork.Serialization.cs | 5 ++++ .../Generated/Models/VirtualNetwork.cs | 22 +++++++++++++--- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/Eryph.ComputeClient/Generated/EryphComputeClientModelFactory.cs b/src/Eryph.ComputeClient/Generated/EryphComputeClientModelFactory.cs index f0d4c3b..6727e79 100644 --- a/src/Eryph.ComputeClient/Generated/EryphComputeClientModelFactory.cs +++ b/src/Eryph.ComputeClient/Generated/EryphComputeClientModelFactory.cs @@ -402,35 +402,9 @@ public static GeneWithUsage GeneWithUsage(string id = null, GeneType geneType = /// /// /// - /// , , , , or is null. /// A new instance for mocking. public static VirtualNetwork VirtualNetwork(string id = null, string name = null, Project project = null, string environment = null, string providerName = null, string ipNetwork = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - if (environment == null) - { - throw new ArgumentNullException(nameof(environment)); - } - if (providerName == null) - { - throw new ArgumentNullException(nameof(providerName)); - } - if (ipNetwork == null) - { - throw new ArgumentNullException(nameof(ipNetwork)); - } - return new VirtualNetwork( id, name, diff --git a/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.Serialization.cs b/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.Serialization.cs index d714c92..7f706a9 100644 --- a/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.Serialization.cs +++ b/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.Serialization.cs @@ -53,6 +53,11 @@ internal static VirtualNetwork DeserializeVirtualNetwork(JsonElement element) } if (property.NameEquals("ip_network"u8)) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + ipNetwork = null; + continue; + } ipNetwork = property.Value.GetString(); continue; } diff --git a/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.cs b/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.cs index 12b2c10..6b90aa3 100644 --- a/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.cs +++ b/src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.cs @@ -18,22 +18,36 @@ public partial class VirtualNetwork /// /// /// - /// - /// , , , , or is null. - internal VirtualNetwork(string id, string name, Project project, string environment, string providerName, string ipNetwork) + /// , , , or is null. + internal VirtualNetwork(string id, string name, Project project, string environment, string providerName) { Argument.AssertNotNull(id, nameof(id)); Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(project, nameof(project)); Argument.AssertNotNull(environment, nameof(environment)); Argument.AssertNotNull(providerName, nameof(providerName)); - Argument.AssertNotNull(ipNetwork, nameof(ipNetwork)); Id = id; Name = name; Project = project; Environment = environment; ProviderName = providerName; + } + + /// Initializes a new instance of . + /// + /// + /// + /// + /// + /// + internal VirtualNetwork(string id, string name, Project project, string environment, string providerName, string ipNetwork) + { + Id = id; + Name = name; + Project = project; + Environment = environment; + ProviderName = providerName; IpNetwork = ipNetwork; }