Skip to content

Commit cbc20bb

Browse files
committed
Fix cases where the schemas will not be componetized because the x-schema-id is null or empty
1 parent 32a3dd1 commit cbc20bb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,10 @@ internal static bool WillBeComponentized(this JsonNode schema, [NotNullWhen(true
455455
&& schemaIdNode.GetValueKind() == JsonValueKind.String)
456456
{
457457
schemaId = schemaIdNode.GetValue<string>();
458-
return true;
458+
if (!string.IsNullOrEmpty(schemaId))
459+
{
460+
return true;
461+
}
459462
}
460463
schemaId = null;
461464
return false;

src/OpenApi/src/Extensions/OpenApiSchemaExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public static bool IsComponentizedSchema(this OpenApiSchema schema, out string s
2828
{
2929
if(schema.Metadata is not null
3030
&& schema.Metadata.TryGetValue(OpenApiConstants.SchemaId, out var schemaIdAsObject)
31-
&& schemaIdAsObject is string schemaIdString)
31+
&& schemaIdAsObject is string schemaIdString
32+
&& !string.IsNullOrEmpty(schemaIdString))
3233
{
3334
schemaId = schemaIdString;
3435
return true;

0 commit comments

Comments
 (0)