Skip to content

Commit dc86b10

Browse files
committed
Docs and tweaks
1 parent 7fe1e80 commit dc86b10

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,12 @@ internal static void ApplyNullabilityContextInfo(this JsonNode schema, JsonPrope
467467
}
468468
}
469469

470-
internal static void PruneNullTypeForReferencedTypes(this JsonNode schema)
470+
/// <summary>
471+
/// Prunes the "null" type from the schema for types that are componentized. These
472+
/// types should represent their nullability using allOf with null instead.
473+
/// </summary>
474+
/// <param name="schema"></param>
475+
internal static void PruneNullTypeForComponentizedTypes(this JsonNode schema)
471476
{
472477
if (schema[OpenApiConstants.SchemaId] is not null &&
473478
schema[OpenApiSchemaKeywords.TypeKeyword] is JsonArray typeArray)

src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ internal sealed class OpenApiSchemaService(
132132
}
133133
}
134134
}
135-
schema.PruneNullTypeForReferencedTypes();
135+
schema.PruneNullTypeForComponentizedTypes();
136136
return schema;
137137
}
138138
};

0 commit comments

Comments
 (0)