diff --git a/csharp/Squidex.ClientLibrary/CodeGeneration/Client.Class.liquid b/csharp/Squidex.ClientLibrary/CodeGeneration/Client.Class.liquid index c240e88..b5c0044 100644 --- a/csharp/Squidex.ClientLibrary/CodeGeneration/Client.Class.liquid +++ b/csharp/Squidex.ClientLibrary/CodeGeneration/Client.Class.liquid @@ -234,10 +234,12 @@ {% for parameter in operation.FormParameters %} {% if parameter.IsNullable -%} if ({{ parameter.VariableName }} != null) -{% else -%} +{% elsif parameter.IsNullable == false and parameter.IsRequired -%} if ({{ parameter.VariableName }} == null) throw new System.ArgumentNullException("{{ parameter.VariableName }}"); else +{% else -%} + if ({{ parameter.VariableName }} != null) {% endif -%} { {% if parameter.IsFile -%} diff --git a/csharp/Squidex.ClientLibrary/Directory.Build.props b/csharp/Squidex.ClientLibrary/Directory.Build.props index 7ef243d..c502920 100644 --- a/csharp/Squidex.ClientLibrary/Directory.Build.props +++ b/csharp/Squidex.ClientLibrary/Directory.Build.props @@ -15,7 +15,7 @@ Squidex HeadlessCMS true snupkg - 19.6.0 + 19.7.0 diff --git a/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/Generated.cs b/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/Generated.cs index 6324c7a..25fc101 100644 --- a/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/Generated.cs +++ b/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/Generated.cs @@ -1,4 +1,4 @@ -//---------------------- +//---------------------- // // Generated using the NSwag toolchain v14.0.1.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // @@ -16796,9 +16796,7 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); - if (file == null) - throw new System.ArgumentNullException("file"); - else + if (file != null) { var content_file_ = new System.Net.Http.StreamContent(file.Data); if (!string.IsNullOrEmpty(file.ContentType)) @@ -16806,16 +16804,12 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Add(content_file_, "file", file.FileName ?? "file"); } - if (fileUrl == null) - throw new System.ArgumentNullException("fileUrl"); - else + if (fileUrl != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileUrl, System.Globalization.CultureInfo.InvariantCulture)), "fileUrl"); } - if (fileName == null) - throw new System.ArgumentNullException("fileName"); - else + if (fileName != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture)), "fileName"); } @@ -17178,9 +17172,7 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); - if (file == null) - throw new System.ArgumentNullException("file"); - else + if (file != null) { var content_file_ = new System.Net.Http.StreamContent(file.Data); if (!string.IsNullOrEmpty(file.ContentType)) @@ -17188,16 +17180,12 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Add(content_file_, "file", file.FileName ?? "file"); } - if (fileUrl == null) - throw new System.ArgumentNullException("fileUrl"); - else + if (fileUrl != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileUrl, System.Globalization.CultureInfo.InvariantCulture)), "fileUrl"); } - if (fileName == null) - throw new System.ArgumentNullException("fileName"); - else + if (fileName != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture)), "fileName"); } @@ -17675,9 +17663,7 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); - if (file == null) - throw new System.ArgumentNullException("file"); - else + if (file != null) { var content_file_ = new System.Net.Http.StreamContent(file.Data); if (!string.IsNullOrEmpty(file.ContentType)) @@ -17685,16 +17671,12 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Add(content_file_, "file", file.FileName ?? "file"); } - if (fileUrl == null) - throw new System.ArgumentNullException("fileUrl"); - else + if (fileUrl != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileUrl, System.Globalization.CultureInfo.InvariantCulture)), "fileUrl"); } - if (fileName == null) - throw new System.ArgumentNullException("fileName"); - else + if (fileName != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture)), "fileName"); } @@ -19547,9 +19529,7 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); - if (file == null) - throw new System.ArgumentNullException("file"); - else + if (file != null) { var content_file_ = new System.Net.Http.StreamContent(file.Data); if (!string.IsNullOrEmpty(file.ContentType)) @@ -19557,16 +19537,12 @@ private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() content_.Add(content_file_, "file", file.FileName ?? "file"); } - if (fileUrl == null) - throw new System.ArgumentNullException("fileUrl"); - else + if (fileUrl != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileUrl, System.Globalization.CultureInfo.InvariantCulture)), "fileUrl"); } - if (fileName == null) - throw new System.ArgumentNullException("fileName"); - else + if (fileName != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(fileName, System.Globalization.CultureInfo.InvariantCulture)), "fileName"); } @@ -28084,4 +28060,4 @@ public SquidexException(string message, int statusCode, string response, System. #pragma warning restore 3016 #pragma warning restore 8603 #pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file +#pragma warning restore 8625