Skip to content

Commit

Permalink
Fix incorrect nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherMann committed Nov 22, 2024
1 parent ef7fa1e commit 0e39876
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,35 +402,9 @@ public static GeneWithUsage GeneWithUsage(string id = null, GeneType geneType =
/// <param name="environment"></param>
/// <param name="providerName"></param>
/// <param name="ipNetwork"></param>
/// <exception cref="ArgumentNullException"> <paramref name="id"/>, <paramref name="name"/>, <paramref name="project"/>, <paramref name="environment"/>, <paramref name="providerName"/> or <paramref name="ipNetwork"/> is null. </exception>
/// <returns> A new <see cref="Models.VirtualNetwork"/> instance for mocking. </returns>
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
22 changes: 18 additions & 4 deletions src/Eryph.ComputeClient/Generated/Models/VirtualNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,36 @@ public partial class VirtualNetwork
/// <param name="project"></param>
/// <param name="environment"></param>
/// <param name="providerName"></param>
/// <param name="ipNetwork"></param>
/// <exception cref="ArgumentNullException"> <paramref name="id"/>, <paramref name="name"/>, <paramref name="project"/>, <paramref name="environment"/>, <paramref name="providerName"/> or <paramref name="ipNetwork"/> is null. </exception>
internal VirtualNetwork(string id, string name, Project project, string environment, string providerName, string ipNetwork)
/// <exception cref="ArgumentNullException"> <paramref name="id"/>, <paramref name="name"/>, <paramref name="project"/>, <paramref name="environment"/> or <paramref name="providerName"/> is null. </exception>
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;
}

/// <summary> Initializes a new instance of <see cref="VirtualNetwork"/>. </summary>
/// <param name="id"></param>
/// <param name="name"></param>
/// <param name="project"></param>
/// <param name="environment"></param>
/// <param name="providerName"></param>
/// <param name="ipNetwork"></param>
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;
}

Expand Down

0 comments on commit 0e39876

Please sign in to comment.