Skip to content

Commit 78af6ff

Browse files
committed
chore: refactoring
Signed-off-by: Vincent Biret <[email protected]>
1 parent bf2bb5b commit 78af6ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiEdmTypeSchemaGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public static OpenApiSchema CreateSchema(this ODataContext context, IEdmPrimitiv
133133
}
134134

135135
// Nullable properties are marked with the keyword nullable and a value of true.
136-
// oneOf and anyOf don't have type, so they can't be set to nullable, entries are nullable
137-
schema.Nullable = schema.AnyOf == null && schema.OneOf == null && primitiveType.IsNullable;
136+
// nullable cannot be true when type is empty, often common in anyof/allOf since individual entries are nullable
137+
schema.Nullable = !string.IsNullOrEmpty(schema.Type) && primitiveType.IsNullable;
138138
}
139139

140140
return schema;

0 commit comments

Comments
 (0)