Skip to content

Validation

cognite.pygen._core.validation

This module contains functions for validating the uniqueness of names in the generated classes.

validate_api_classes_unique_names(api_classes)

Checks that fields that are used in shared namespaces the API classes have unique names.

Source code in cognite/pygen/_core/validation.py
def validate_api_classes_unique_names(api_classes: list[APIClass]) -> None:
    """Checks that fields that are used in shared namespaces the API classes have unique names."""
    _validate(api_classes, _APICLASS_UNIQUE_PROPERTIES, "view_id", APIClass.__name__)

validate_data_classes_unique_name(data_classes)

Checks that fields that are used in shared namespaces the data classes have unique names.

Source code in cognite/pygen/_core/validation.py
def validate_data_classes_unique_name(data_classes: list[DataClass]) -> None:
    """Checks that fields that are used in shared namespaces the data classes have unique names."""
    _validate(data_classes, _DATACLASS_UNIQUE_PROPERTIES, "view_id", DataClass.__name__)

validate_multi_api_classes_unique_names(multi_api_classes)

Checks that fields that are used in shared namespaces the MultiAPI classes have unique names.

Source code in cognite/pygen/_core/validation.py
def validate_multi_api_classes_unique_names(multi_api_classes: list[MultiAPIClass]) -> None:
    """Checks that fields that are used in shared namespaces the MultiAPI classes have unique names."""
    _validate(multi_api_classes, _MULTIAPICLASS_UNIQUE_PROPERTIES, "model_id", MultiAPIClass.__name__)