diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs index f7e371d00f..17a67c842c 100644 --- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs @@ -29,7 +29,7 @@ public static IEnumerable GetSchemaNames(this OpenApiSchema schema, bool internal static IEnumerable FlattenSchemaIfRequired(this IList schemas, Func> subsequentGetter) { if (schemas is null) return []; - return schemas.Count == 1 && !schemas[0].Properties.Any() ? + return schemas.Count == 1 && !schemas[0].HasAnyProperty() ? schemas.FlattenEmptyEntries(subsequentGetter, 1) : schemas; } @@ -144,7 +144,7 @@ public static bool IsComposedEnum(this OpenApiSchema schema) public static bool IsSemanticallyMeaningful(this OpenApiSchema schema, bool ignoreNullableObjects = false) { if (schema is null) return false; - return schema.Properties.Any() || + return schema.HasAnyProperty() || schema.Enum is { Count: > 0 } || schema.Items != null || (!string.IsNullOrEmpty(schema.Type) && diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 8e425eaa32..b7ef75e848 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1604,7 +1604,7 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo if (typesCount == 1 && schema.Nullable && schema.IsInclusiveUnion() || // nullable on the root schema outside of anyOf typesCount == 2 && (schema.AnyOf?.Any(static x => // nullable on a schema in the anyOf x.Nullable && - !x.Properties.Any() && + !x.HasAnyProperty() && !x.IsExclusiveUnion() && !x.IsInclusiveUnion() && !x.IsInherited() &&