diff --git a/modules/openapi-generator/src/main/resources/csharp/auth/TokenResponse.mustache b/modules/openapi-generator/src/main/resources/csharp/auth/TokenResponse.mustache index becd82d87a1..7a72e04c12c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/auth/TokenResponse.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/auth/TokenResponse.mustache @@ -19,6 +19,6 @@ namespace {{packageName}}.Client.Auth [JsonProperty("refresh_token")] public string{{nrt?}} RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index ab1cf58090d..5ff4349979f 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index d3703f73dd7..95e03c36e10 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index d3703f73dd7..95e03c36e10 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index 9b9fc94bbf8..da4f4499b1c 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string? RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index 9b9fc94bbf8..da4f4499b1c 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string? RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index d3703f73dd7..95e03c36e10 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs index d3703f73dd7..95e03c36e10 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs @@ -27,6 +27,6 @@ namespace Org.OpenAPITools.Client.Auth [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - public DateTime? ExpiresAt => ExpiresIn == null ? null : Created.AddSeconds(ExpiresIn.Value); + public DateTime? ExpiresAt => ExpiresIn == null ? null : Created?.AddSeconds(ExpiresIn.Value); } } \ No newline at end of file