-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: anyOf/oneOf missing properties for intersection/inheritance
- Loading branch information
Showing
5 changed files
with
603 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Kiota.Builder.Extensions; | ||
|
||
public static class IListExtensions | ||
{ | ||
/// <summary> | ||
/// Returns the only element of this list when it has count of exactly <c>1</c> | ||
/// </summary> | ||
/// <typeparam name="T">The contained item type.</typeparam> | ||
/// <param name="items">The items.</param> | ||
/// <returns>The only element or null.</returns> | ||
internal static T? OnlyOneOrDefault<T>(this IList<T> items) => | ||
items.Count == 1 ? items[0] : default; | ||
|
||
/// <summary> | ||
/// Adds the provided <paramref name="values"/> to this list. | ||
/// </summary> | ||
/// <typeparam name="T">The contained item type.</typeparam> | ||
/// <param name="items">The items.</param> | ||
/// <param name="values">The values to add.</param> | ||
internal static void AddRange<T>(this IList<T> items, IEnumerable<T> values) | ||
{ | ||
foreach (var item in values) | ||
{ | ||
items.Add(item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.