Skip to content

Commit cb01494

Browse files
committed
Exclude documentation entries from catalog
1 parent d2e6c14 commit cb01494

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

AddonCatalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, data: Dict[str, Any]):
8989
def _parse_raw_data(self):
9090
self._dictionary = {} # Clear pre-existing contents
9191
for key, value in self._original_data.items():
92-
if key == "_meta": # Don't add the documentation object to the tree
92+
if key in ["_meta", "$schema"]: # Don't add the documentation objects to the tree
9393
continue
9494
self._dictionary[key] = []
9595
for entry in value:

AddonManagerTest/app/test_addoncatalog.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,16 @@ def test_load_metadata_cache(self):
211211
with patch("addonmanager_freecad_interface.Version", return_value=cache):
212212
with patch("AddonCatalog.Addon") as addon_mock:
213213
catalog.load_metadata_cache(cache)
214+
215+
def test_documentation_not_added(self):
216+
"""Ensure that the documentation objects don't get added to the catalog"""
217+
data = {
218+
"$schema": "https://raw.githubusercontent.com/FreeCAD/AddonManager/refs/heads/main/AddonCatalog.schema.json",
219+
"_meta": {"description": "Meta", "schema_version": "1.0.0"},
220+
"AnAddon": [{"git_ref": "main"}],
221+
}
222+
catalog = AddonCatalog(data)
223+
ids = catalog.get_available_addon_ids()
224+
self.assertNotIn("_meta", ids)
225+
self.assertNotIn("$schema", ids)
226+
self.assertIn("AnAddon", ids)

0 commit comments

Comments
 (0)