Skip to content

Commit 59240b3

Browse files
committed
Prefer the original type before the inferred type
1 parent c532c4e commit 59240b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ private void SerializeAsV2(
784784

785785
private void SerializeTypeProperty(IOpenApiWriter writer, OpenApiSpecVersion version, JsonSchemaType? inferredType = null)
786786
{
787-
// Use inferred type from oneOf/anyOf if provided and original type is not set
788-
var typeToUse = inferredType ?? Type;
787+
// Use original type or inferred type when the explicit type is not set
788+
var typeToUse = Type ?? inferredType;
789789

790790
if (typeToUse is null)
791791
{

0 commit comments

Comments
 (0)