diff --git a/src/Elastic.ApiExplorer/Components/PropertyTree/_Partials/_UnionOptions.cshtml b/src/Elastic.ApiExplorer/Components/PropertyTree/_Partials/_UnionOptions.cshtml
index 3e11acadab..93f4afac64 100644
--- a/src/Elastic.ApiExplorer/Components/PropertyTree/_Partials/_UnionOptions.cshtml
+++ b/src/Elastic.ApiExplorer/Components/PropertyTree/_Partials/_UnionOptions.cshtml
@@ -70,9 +70,9 @@
var collapsible = variant.IsCollapsible;
var expanded = Model.UseChips || variant.DefaultExpanded;
var folded = variant.UseHidden && !Model.UseChips;
- // An array variant keeps its "X[]" heading, so its fields read as each item's; a primitive keeps its type, which is
- // all its panel has to show.
- var showName = !Model.UseChips || variant.PageUrl is { Length: > 0 } || variant.IsArrayVariant || !variant.IsObjectType;
+ // An array variant keeps its "X[]" heading, so its fields read as each item's. A primitive's chip already says its
+ // type, so its panel shows nothing more than the description, if any.
+ var showName = !Model.UseChips || variant.PageUrl is { Length: > 0 } || variant.IsArrayVariant;
var showLabel = showName || variant.DiscriminatorLabel is { Length: > 0 };
diff --git a/tests/Elastic.ApiExplorer.Tests/UnionOptionsRenderingTests.cs b/tests/Elastic.ApiExplorer.Tests/UnionOptionsRenderingTests.cs
index e623afd6eb..cf7ec6cfc5 100644
--- a/tests/Elastic.ApiExplorer.Tests/UnionOptionsRenderingTests.cs
+++ b/tests/Elastic.ApiExplorer.Tests/UnionOptionsRenderingTests.cs
@@ -22,7 +22,7 @@ public async Task Render_OneObjectAndAPrimitive_ShowChips()
.Contain("data-chip-row")
.And
.Contain("""id="v-1" hidden="until-found">""", "TotalHits or number reads like any other union");
- html.Should().Contain(">Variant1", "the primitive keeps its type name");
+ html.Should().NotContain(">Variant1", "the primitive's chip already names its type");
}
[Test]
@@ -42,12 +42,16 @@ public async Task Render_TwoObjects_ShowChips()
}
[Test]
- public async Task Render_PrimitiveVariantBehindChips_KeepsItsTypeName()
+ public async Task Render_PrimitiveVariantBehindChips_LeavesItsPanelWithoutTheTypeName()
{
- // Variant2 is an array, which keeps its name anyway; Variant3 is a plain primitive.
+ // Variant2 is an array, which keeps its heading; Variant3 is a plain primitive.
var html = await Render(4, objects: 3);
- html.Should().Contain(">Variant3", "a primitive's type is all its panel has to show");
+ html.Should().NotContain(">Variant3", "a primitive's type is on its chip");
+ html.Should().Contain(
+ ">Variant2[]",
+ "an array variant keeps its heading"
+ );
html.Should().NotContain(">Variant0", "an object variant's name is on its chip");
}