Skip to content

Commit e65c939

Browse files
committed
Fix build warning in samples
1 parent 032817f commit e65c939

File tree

39 files changed

+44
-39
lines changed

39 files changed

+44
-39
lines changed

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,12 @@ using System.Net.Http.Headers;
324324
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
325325
{
326326
if (accepts.Length == 0)
327-
return null;
327+
{{#net80OrLater}}
328+
return [];
329+
{{/net80OrLater}}
330+
{{^net80OrLater}}
331+
return Enumerable.Empty<MediaTypeWithQualityHeaderValue>();
332+
{{/net80OrLater}}
328333

329334
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
330335
{{#net80OrLater}}

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public static byte[] ReadAsBytes(Stream inputStream)
239239
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
240240
{
241241
if (accepts.Length == 0)
242-
return null;
242+
return [];
243243

244244
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
245245
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static byte[] ReadAsBytes(Stream inputStream)
233233
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
234234
{
235235
if (accepts.Length == 0)
236-
return null;
236+
return [];
237237

238238
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
239239
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public static byte[] ReadAsBytes(Stream inputStream)
235235
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
236236
{
237237
if (accepts.Length == 0)
238-
return null;
238+
return [];
239239

240240
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
241241
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];

samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static byte[] ReadAsBytes(Stream inputStream)
233233
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
234234
{
235235
if (accepts.Length == 0)
236-
return null;
236+
return [];
237237

238238
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
239239
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];

samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public static byte[] ReadAsBytes(Stream inputStream)
259259
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
260260
{
261261
if (accepts.Length == 0)
262-
return null;
262+
return [];
263263

264264
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
265265
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];

samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static string SelectHeaderAccept(string[] accepts)
244244
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
245245
{
246246
if (accepts.Length == 0)
247-
return null;
247+
return Enumerable.Empty<MediaTypeWithQualityHeaderValue>();
248248

249249
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
250250
return new [] { MediaTypeWithQualityHeaderValue.Parse("application/json") };

samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static string SelectHeaderAccept(string[] accepts)
244244
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
245245
{
246246
if (accepts.Length == 0)
247-
return null;
247+
return Enumerable.Empty<MediaTypeWithQualityHeaderValue>();
248248

249249
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
250250
return new [] { MediaTypeWithQualityHeaderValue.Parse("application/json") };

samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public static string SelectHeaderAccept(string[] accepts)
229229
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
230230
{
231231
if (accepts.Length == 0)
232-
return null;
232+
return Enumerable.Empty<MediaTypeWithQualityHeaderValue>();
233233

234234
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
235235
return new [] { MediaTypeWithQualityHeaderValue.Parse("application/json") };

samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public static string SelectHeaderAccept(string[] accepts)
344344
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
345345
{
346346
if (accepts.Length == 0)
347-
return null;
347+
return Enumerable.Empty<MediaTypeWithQualityHeaderValue>();
348348

349349
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
350350
return new [] { MediaTypeWithQualityHeaderValue.Parse("application/json") };

0 commit comments

Comments
 (0)