+* Validate resource names ([#357](https://github.com/databrickslabs/lsql/issues/357)). This pull request introduces a validation feature to the `ucx` project for resource names, specifically for dashboard tile IDs. The new naming convention restricts resource names to alphanumeric characters, hyphens, and underscores, enhancing usability and reducing potential issues caused by special characters. A new method, `_is_valid_resource_name`, is implemented to check if a name is valid based on the defined pattern. The `TileMetadata` class is updated to ensure its `id` attribute adheres to the new validation rules, and a `validate` method is added to raise a `ValueError` if the tile metadata is invalid. This method checks if the `id` attribute is not empty and if it is a valid resource name. Additionally, the `validate` method is updated in the `Tile`, `Section`, and `Dashboard` classes to call the `validate` method of the `TileMetadata` instance, if it exists. The pull request also includes tests for the new validation functionality, ensuring that tile IDs cannot be empty, must contain only alphanumeric characters, hyphens, and underscores, and that the `validate` method detects duplicate query IDs and widget IDs. This validation helps maintain consistency and correctness in dashboard resources, making it easier for users to manage and interact with their dashboards.
0 commit comments