The AI component catalog no longer offers the deprecated inner layers, and lists the new 'Board Side' property

This commit is contained in:
Bane Stojkovic
2026-11-11 17:05:44 +01:00
parent 19c78e5fa9
commit 5ef6952ef4
7 changed files with 264 additions and 20 deletions
@@ -96,6 +96,10 @@ public class ComponentCatalogGeneratorTest {
(List<Map<String, Object>>) togglePinout.get("variants");
assertTrue("every switch type should be described", variants.size() > 1);
assertTrue("a switch carries its switching table", variants.get(0).containsKey("switching"));
// the deprecated inner layers are kept only so that old files load
Map<String, Object> layer = findProperty(find(components, "connectivity.CopperTrace"), "Layer");
assertEquals(List.of("_1", "_2"), layer.get("possibleValues"));
}
@Test
@@ -112,6 +116,13 @@ public class ComponentCatalogGeneratorTest {
ComponentCatalogGenerator.collectNotes(Leaf.class, EnumSet.of(Scope.SELECTION)));
}
@SuppressWarnings("unchecked")
private static Map<String, Object> findProperty(Map<String, Object> component, String name) {
return ((List<Map<String, Object>>) component.get("properties")).stream()
.filter(p -> name.equals(p.get("name"))).findFirst()
.orElseThrow(() -> new AssertionError("no property " + name));
}
private static Map<String, Object> find(List<Map<String, Object>> components, String className) {
return components.stream().filter(c -> className.equals(c.get("className"))).findFirst()
.orElseThrow(() -> new AssertionError("no catalog entry for " + className));