Skip to content

Commit dbdea2b

Browse files
authored
fix(omvs): by-name type filter reaches Egeria; read nestedSolutionComponents (ISSUE-131, ISSUE-133) (#439)
ISSUE-131: 13 *_by_name wrappers passed the type filter to _async_get_name_request as `metadata_element_type` (the _async_find_request spelling). The helper reads `metadata_element_type_name`, so the value fell into **kwargs, FilterRequestBody dropped it, and the search ran unfiltered by type. The helper now accepts both spellings (the canonical one wins), and the 13 wrappers use the canonical key. The 14 find_* wrappers were already correct and are unchanged. ISSUE-133: Egeria returns a solution component's children as nestedSolutionComponents; no REST response has subComponents. GovernanceOfficer._extract_solution_components_properties read only subComponents (it currently has no callers). Removed the never-matching subComponents fallbacks in solution_architect.py (two) and md_processing/v2/solution_architect.py. Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
1 parent f2f9dcb commit dbdea2b

12 files changed

Lines changed: 145 additions & 32 deletions

‎md_processing/v2/solution_architect.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,6 @@ async def _get_component_related_elements(self, guid: str) -> Dict[str, Any]:
384384
for comp in response.get('nestedSolutionComponents', []):
385385
res["sub_component_guids"].append(comp['relatedElement']['elementHeader'].get('guid'))
386386

387-
# subComponents
388-
for comp in response.get('subComponents', []):
389-
res["sub_component_guids"].append(comp['elementHeader'].get('guid'))
390-
391387
# usedInSolutionComponents (Parents)
392388
for comp in response.get('usedInSolutionComponents', []):
393389
res["parent_component_guids"].append(comp['relatedElement']['elementHeader'].get('guid'))

‎pyegeria/core/_server_client.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,6 +6589,13 @@ async def _async_get_name_request(self, url: str, _type: str, _gen_output: Calla
65896589
body: Optional[dict | FilterRequestBody] = None,
65906590
max_mermaid_node_count=10, **kwargs) -> Any:
65916591

6592+
# _async_find_request spells this argument `metadata_element_type`; a wrapper copied from a find_*
6593+
# sibling passed that spelling here, where it fell into **kwargs and FilterRequestBody silently
6594+
# dropped it, so the by-name search ran unfiltered by type (ISSUE-131). Accept both.
6595+
legacy_type_name = kwargs.pop("metadata_element_type", None)
6596+
if metadata_element_type_name is None:
6597+
metadata_element_type_name = legacy_type_name
6598+
65926599
if isinstance(body, FilterRequestBody):
65936600
validated_body = body
65946601
elif isinstance(body, dict):

‎pyegeria/omvs/actor_manager.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ async def _async_get_actor_profiles_by_name(
953953
url = str(HttpUrl(f"{self.command_root}/actor-profiles/by-name"))
954954
params = {
955955
"filter_string": name,
956-
"metadata_element_type": metadata_element_type_name,
956+
"metadata_element_type_name": metadata_element_type_name,
957957
"metadata_element_subtypes": metadata_element_subtypes,
958958
"include_only_relationships": include_only_relationships,
959959
"skip_relationships": skip_relationships,
@@ -2514,7 +2514,7 @@ async def _async_get_actor_roles_by_name(
25142514
url = str(HttpUrl(f"{self.command_root}/actor-roles/by-name"))
25152515
params = {
25162516
"filter_string": name,
2517-
"metadata_element_type": metadata_element_type_name,
2517+
"metadata_element_type_name": metadata_element_type_name,
25182518
"metadata_element_subtypes": metadata_element_subtypes,
25192519
"include_only_relationships": include_only_relationships,
25202520
"skip_relationships": skip_relationships,
@@ -4193,7 +4193,7 @@ async def _async_get_user_identities_by_name(
41934193
url = str(HttpUrl(f"{self.command_root}/user-identities/by-name"))
41944194
params = {
41954195
"filter_string": name,
4196-
"metadata_element_type": metadata_element_type_name,
4196+
"metadata_element_type_name": metadata_element_type_name,
41974197
"metadata_element_subtypes": metadata_element_subtypes,
41984198
"include_only_relationships": include_only_relationships,
41994199
"skip_relationships": skip_relationships,
@@ -4885,7 +4885,7 @@ async def _async_get_contribution_records_by_name(
48854885
url = f"{self.command_root}/contribution-records/by-name"
48864886
params = {
48874887
"filter_string": name,
4888-
"metadata_element_type": metadata_element_type_name,
4888+
"metadata_element_type_name": metadata_element_type_name,
48894889
"metadata_element_subtypes": metadata_element_subtypes,
48904890
"include_only_relationships": include_only_relationships,
48914891
"skip_relationships": skip_relationships,
@@ -6069,7 +6069,7 @@ async def _async_get_contact_details_by_name(
60696069
url = f"{self.command_root}/contact-details/by-name"
60706070
params = {
60716071
"filter_string": name,
6072-
"metadata_element_type": metadata_element_type_name,
6072+
"metadata_element_type_name": metadata_element_type_name,
60736073
"metadata_element_subtypes": metadata_element_subtypes,
60746074
"include_only_relationships": include_only_relationships,
60756075
"skip_relationships": skip_relationships,
@@ -6875,7 +6875,7 @@ async def _async_get_perspectives_by_name(
68756875
url = str(HttpUrl(f"{self.command_root}/perspectives/by-name"))
68766876
params = {
68776877
"filter_string": name,
6878-
"metadata_element_type": metadata_element_type_name,
6878+
"metadata_element_type_name": metadata_element_type_name,
68796879
"metadata_element_subtypes": metadata_element_subtypes,
68806880
"include_only_relationships": include_only_relationships,
68816881
"skip_relationships": skip_relationships,
@@ -7681,7 +7681,7 @@ async def _async_get_skills_by_name(
76817681
url = str(HttpUrl(f"{self.command_root}/skills/by-name"))
76827682
params = {
76837683
"filter_string": name,
7684-
"metadata_element_type": metadata_element_type_name,
7684+
"metadata_element_type_name": metadata_element_type_name,
76857685
"metadata_element_subtypes": metadata_element_subtypes,
76867686
"include_only_relationships": include_only_relationships,
76877687
"skip_relationships": skip_relationships,

‎pyegeria/omvs/collection_manager.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ async def _async_get_collections_by_name(
844844
url = str(HttpUrl(f"{self.collection_command_root}/by-name"))
845845
params = {
846846
"filter_string": name,
847-
"metadata_element_type": metadata_element_type_name,
847+
"metadata_element_type_name": metadata_element_type_name,
848848
"metadata_element_subtypes": metadata_element_subtypes,
849849
"include_only_relationships": include_only_relationships,
850850
"skip_relationships": skip_relationships,

‎pyegeria/omvs/digital_business.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ async def _async_get_business_capabilities_by_name(
473473
url = f"{self.digital_business_command_root}/collections/by-name"
474474
params = {
475475
"filter_string": name,
476-
"metadata_element_type": metadata_element_type_name,
476+
"metadata_element_type_name": metadata_element_type_name,
477477
"metadata_element_subtypes": metadata_element_subtypes,
478478
"include_only_relationships": include_only_relationships,
479479
"skip_relationships": skip_relationships,

‎pyegeria/omvs/governance_officer.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,13 @@ def _extract_solution_components_properties(self, element: Union[Dict, List[Dict
271271

272272
# Extract sub components
273273
sub_comp_md = ""
274-
sub_components = element.get('subComponents', None)
274+
# Egeria returns children as nestedSolutionComponents (SolutionComposition); there is no
275+
# subComponents field in any REST response (ISSUE-133).
276+
sub_components = element.get('nestedSolutionComponents', None)
275277
if sub_components:
276278
for sub_component in sub_components:
277-
sub_comp_prop = sub_component['properties']
279+
sub_comp_prop = sub_component['relatedElement']['properties']
278280
sub_comp_name = sub_comp_prop.get("displayName", None)
279-
sub_comp_desc = sub_comp_prop.get("description", None)
280281
sub_comp_md += f" {sub_comp_name}"
281282

282283
comp_graph = element.get('mermaidGraph', None)

‎pyegeria/omvs/location_arena.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ async def _async_get_locations_by_name(
12041204
url = f"{self.ref_location_command_base}/locations/by-name"
12051205
params = {
12061206
"filter_string": name,
1207-
"metadata_element_type": metadata_element_type_name,
1207+
"metadata_element_type_name": metadata_element_type_name,
12081208
"metadata_element_subtypes": metadata_element_subtypes,
12091209
"include_only_relationships": include_only_relationships,
12101210
"skip_relationships": skip_relationships,

‎pyegeria/omvs/runtime_manager.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3468,7 +3468,7 @@ async def _async_get_metadata_repository_cohorts_by_name(
34683468
url = f"{self.runtime_command_root}/metadata-repository-cohorts/by-name"
34693469
params = {
34703470
"filter_string": name,
3471-
"metadata_element_type": metadata_element_type_name,
3471+
"metadata_element_type_name": metadata_element_type_name,
34723472
"metadata_element_subtypes": metadata_element_subtypes,
34733473
"graph_query_depth": graph_query_depth,
34743474
"start_from": start_from,

‎pyegeria/omvs/solution_architect.py‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,14 +672,6 @@ def _get_component_rel_elements_dict(self, el_struct: dict)-> dict | str:
672672
parent_qnames.append(comp['relatedElement']['properties'].get("qualifiedName", ""))
673673
parent_names.append(comp['relatedElement']['properties'].get('displayName', ""))
674674

675-
sub_components = el_struct.get("subComponents", {})
676-
if sub_components:
677-
for sub_component in sub_components:
678-
sub_component_guids.append(sub_component['elementHeader']['guid'])
679-
sub_component_qnames.append(sub_component['properties'].get("qualifiedName", ""))
680-
sub_component_names.append(sub_component['properties'].get('displayName', ""))
681-
682-
683675
mermaid = el_struct.get("mermaidGraph", {})
684676

685677
return {"in_components_guids": parent_guids,
@@ -5184,10 +5176,6 @@ def get_component_related_elements(self, guid: str, **kwargs) -> dict:
51845176
guid = comp['relatedElement']['elementHeader'].get('guid', None)
51855177
sub_component_guids.append(guid)
51865178

5187-
sub_components = response.get("subComponents",{})
5188-
for sub_component in sub_components:
5189-
sub_component_guids.append(sub_component["elementHeader"]["guid"])
5190-
51915179
parent_components = response.get('usedInSolutionComponents', None)
51925180
if parent_components is not None:
51935181
for comp in parent_components:

‎pyegeria/omvs/subject_area.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ async def _async_get_subject_areas_by_name(
638638
url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/subject-area/collections/by-name"
639639
params = {
640640
"filter_string": name,
641-
"metadata_element_type": metadata_element_type_name,
641+
"metadata_element_type_name": metadata_element_type_name,
642642
"metadata_element_subtypes": metadata_element_subtypes,
643643
"include_only_relationships": include_only_relationships,
644644
"skip_relationships": skip_relationships,

0 commit comments

Comments
 (0)