villebro commented on code in PR #38200:
URL: https://github.com/apache/superset/pull/38200#discussion_r2848131700


##########
superset-extensions-cli/src/superset_extensions_cli/utils.py:
##########
@@ -266,39 +276,199 @@ def validate_npm_package_name(name: str) -> None:
         raise ExtensionNameError(f"'{name}' is a reserved npm package name")
 
 
-def generate_extension_names(name: str) -> ExtensionNames:
+def validate_publisher(publisher: str) -> None:
     """
-    Generate all extension name variants from display name input.
+    Validate publisher namespace format.
+
+    Args:
+        publisher: Publisher namespace (e.g., 'my-org')
 
-    Flow: Display Name -> Generate ID -> Derive Technical Names from ID
-    Example: "Hello World" -> "hello-world" -> "helloWorld"/"hello_world" 
(from ID)
+    Raises:
+        ExtensionNameError: If publisher is invalid
+    """
+    if not publisher:
+        raise ExtensionNameError("Publisher cannot be empty")
+
+    if not PUBLISHER_REGEX.match(publisher):
+        raise ExtensionNameError(
+            "Publisher must start with a letter and contain only lowercase 
letters, numbers, and hyphens (e.g., 'my-org')"
+        )
+
+    # Check for leading/trailing hyphens
+    if publisher.startswith("-"):
+        raise ExtensionNameError("Publisher cannot start with hyphens")
+
+    if publisher.endswith("-"):
+        raise ExtensionNameError("Publisher cannot end with hyphens")
+
+    # Check for consecutive hyphens
+    if "--" in publisher:
+        raise ExtensionNameError("Publisher cannot have consecutive hyphens")

Review Comment:
   Good catch



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to