diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache index 069758033634..39dbd9c03943 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache @@ -603,7 +603,7 @@ namespace {{packageName}}.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs index 5c8abc6ea702..13e61760f2b9 100644 --- a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs @@ -503,7 +503,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs index ffddac249d05..9a4b99cd8121 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs @@ -497,7 +497,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 02aefa69e18d..601dfdb2f3e7 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -602,7 +602,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 08960c8389ea..ed3aecacd924 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -597,7 +597,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs index d4177aa1d048..1176107c56fa 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs @@ -528,7 +528,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e104bdcf2770..e254dd2413ab 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e104bdcf2770..e254dd2413ab 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs index edbaddee9a0d..d7146853e0f9 100644 --- a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -502,7 +502,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs index 488b3d832e4e..5a7f7e948236 100644 --- a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs @@ -502,7 +502,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs index 35b89b430a80..c89eee968eca 100644 --- a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs @@ -533,7 +533,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs index 18e94ac0845e..3ea2a481c169 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs @@ -628,7 +628,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 18e94ac0845e..3ea2a481c169 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -628,7 +628,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 02aefa69e18d..601dfdb2f3e7 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -602,7 +602,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 08960c8389ea..ed3aecacd924 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -597,7 +597,7 @@ private string GetServerUrl(IList> servers, if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); }