diff --git a/dbt_semantic_interfaces/type_enums/__init__.py b/dbt_semantic_interfaces/type_enums/__init__.py index 954feee4..68b50b85 100644 --- a/dbt_semantic_interfaces/type_enums/__init__.py +++ b/dbt_semantic_interfaces/type_enums/__init__.py @@ -4,7 +4,9 @@ from dbt_semantic_interfaces.type_enums.dimension_type import DimensionType # noqa:F401 from dbt_semantic_interfaces.type_enums.entity_type import EntityType # noqa:F401 from dbt_semantic_interfaces.type_enums.metric_type import MetricType # noqa:F401 -from dbt_semantic_interfaces.type_enums.node_type import NodeType # noqa:F401 +from dbt_semantic_interfaces.type_enums.semantic_manifest_node_type import ( # noqa:F401 + SemanticManifestNodeType, +) from dbt_semantic_interfaces.type_enums.time_granularity import ( # noqa:F401 TimeGranularity, ) diff --git a/dbt_semantic_interfaces/type_enums/node_type.py b/dbt_semantic_interfaces/type_enums/semantic_manifest_node_type.py similarity index 81% rename from dbt_semantic_interfaces/type_enums/node_type.py rename to dbt_semantic_interfaces/type_enums/semantic_manifest_node_type.py index 62de03e4..dcf5bf75 100644 --- a/dbt_semantic_interfaces/type_enums/node_type.py +++ b/dbt_semantic_interfaces/type_enums/semantic_manifest_node_type.py @@ -1,7 +1,7 @@ from dbt_semantic_interfaces.enum_extension import ExtendedEnum -class NodeType(ExtendedEnum): +class SemanticManifestNodeType(ExtendedEnum): """Currently supported node types.""" METRIC = "metric" diff --git a/dbt_semantic_interfaces/validations/unique_valid_name.py b/dbt_semantic_interfaces/validations/unique_valid_name.py index c2c98de9..0ff533a1 100644 --- a/dbt_semantic_interfaces/validations/unique_valid_name.py +++ b/dbt_semantic_interfaces/validations/unique_valid_name.py @@ -16,7 +16,11 @@ ElementReference, SemanticModelElementReference, ) -from dbt_semantic_interfaces.type_enums import EntityType, NodeType, TimeGranularity +from dbt_semantic_interfaces.type_enums import ( + EntityType, + SemanticManifestNodeType, + TimeGranularity, +) from dbt_semantic_interfaces.validations.validator_helpers import ( FileContext, SemanticManifestValidationRule, @@ -170,7 +174,7 @@ def _validate_semantic_model_elements(semantic_model: SemanticModel) -> List[Val @validate_safely(whats_being_done="checking top level elements of a specific type have unique and valid names") def _validate_top_level_objects_of_type( objects: Union[List[SemanticModel], List[Metric], List[SavedQuery]], - object_type: NodeType, + object_type: SemanticManifestNodeType, ) -> List[ValidationIssue]: """Validates uniqeness and validaty of top level objects of singular type.""" issues: List[ValidationIssue] = [] @@ -203,17 +207,19 @@ def _validate_top_level_objects(semantic_manifest: SemanticManifest) -> List[Val issues.extend( UniqueAndValidNameRule._validate_top_level_objects_of_type( - semantic_manifest.semantic_models, NodeType.SEMANTIC_MODEL + semantic_manifest.semantic_models, SemanticManifestNodeType.SEMANTIC_MODEL ) ) issues.extend( - UniqueAndValidNameRule._validate_top_level_objects_of_type(semantic_manifest.metrics, NodeType.METRIC) + UniqueAndValidNameRule._validate_top_level_objects_of_type( + semantic_manifest.metrics, SemanticManifestNodeType.METRIC + ) ) issues.extend( UniqueAndValidNameRule._validate_top_level_objects_of_type( - semantic_manifest.saved_queries, NodeType.SAVED_QUERY + semantic_manifest.saved_queries, SemanticManifestNodeType.SAVED_QUERY ) ) diff --git a/tests/validations/test_unique_valid_name.py b/tests/validations/test_unique_valid_name.py index 5308e546..3bc00be3 100644 --- a/tests/validations/test_unique_valid_name.py +++ b/tests/validations/test_unique_valid_name.py @@ -7,7 +7,7 @@ PydanticSemanticManifest, ) from dbt_semantic_interfaces.test_utils import find_semantic_model_with -from dbt_semantic_interfaces.type_enums import NodeType +from dbt_semantic_interfaces.type_enums import SemanticManifestNodeType from dbt_semantic_interfaces.validations.semantic_manifest_validator import ( SemanticManifestValidator, ) @@ -62,8 +62,9 @@ def test_duplicate_semantic_model_name( # noqa: D model.semantic_models.append(duplicated_semantic_model) with pytest.raises( SemanticManifestValidationException, - match=rf"Can't use name `{duplicated_semantic_model.name}` for a {NodeType.SEMANTIC_MODEL} when it was " - f"already used for another {NodeType.SEMANTIC_MODEL}", + match=rf"Can't use name `{duplicated_semantic_model.name}` for a " + f"{SemanticManifestNodeType.SEMANTIC_MODEL} when it was " + f"already used for another {SemanticManifestNodeType.SEMANTIC_MODEL}", ): SemanticManifestValidator[PydanticSemanticManifest]( [UniqueAndValidNameRule[PydanticSemanticManifest]()] @@ -99,8 +100,9 @@ def test_duplicate_metric_name( # noqa:D model.metrics.append(duplicated_metric) with pytest.raises( SemanticManifestValidationException, - match=rf"Can't use name `{duplicated_metric.name}` for a {NodeType.METRIC} when it was already used for " - f"another {NodeType.METRIC}", + match=rf"Can't use name `{duplicated_metric.name}` for a " + f"{SemanticManifestNodeType.METRIC} when it was already used for " + f"another {SemanticManifestNodeType.METRIC}", ): SemanticManifestValidator[PydanticSemanticManifest]([UniqueAndValidNameRule()]).checked_validations(model) @@ -148,8 +150,9 @@ def test_duplicate_saved_query_name( # noqa: D manifest.saved_queries.append(duplicated_saved_query) with pytest.raises( SemanticManifestValidationException, - match=rf"Can't use name `{duplicated_saved_query.name}` for a {NodeType.SAVED_QUERY} when it was already used " - f"for another {NodeType.SAVED_QUERY}", + match=rf"Can't use name `{duplicated_saved_query.name}` for a " + f"{SemanticManifestNodeType.SAVED_QUERY} when it was already used " + f"for another {SemanticManifestNodeType.SAVED_QUERY}", ): SemanticManifestValidator[PydanticSemanticManifest]( [UniqueAndValidNameRule[PydanticSemanticManifest]()]