Skip to content

Commit

Permalink
fix: not include properties pointing to views not in model
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Jan 31, 2025
1 parent 9f7a3ae commit 157e584
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cognite/neat/_rules/transformers/_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,10 @@ def _create_views(
renaming: dict[ViewEntity, ViewEntity] = {}
new_views = SheetList[DMSView]()
read_view_by_new_view: dict[ViewEntity, ViewEntity] = {}
skipped_views: set[ViewEntity] = set()
for ref_view in reference.views:
if (self.skip_cognite_views and ref_view.view.space in COGNITE_SPACES) or (
self.exclude_views_in_other_spaces and ref_view.view.space != reference.metadata.space
):
skipped_views.add(ref_view.view)
continue
new_entity = ViewEntity(
# MyPy we validate that version is string in the constructor
Expand Down Expand Up @@ -603,8 +601,9 @@ def _create_views(
new_views.append(ref_view.model_copy(deep=True, update={"implements": None, "view": new_entity}))

new_properties = SheetList[DMSProperty]()
views = {view.view: view for view in new_views}
for prop in reference.properties:
if prop.view in skipped_views:
if prop.view not in views or (isinstance(prop.value_type, ViewEntity) and prop.value_type not in views):
continue
new_property = prop.model_copy(deep=True)
if new_property.value_type in renaming and isinstance(new_property.value_type, ViewEntity):
Expand Down

0 comments on commit 157e584

Please sign in to comment.