diff --git a/src/metabase/api/common/internal.clj b/src/metabase/api/common/internal.clj index cf5406df8a666badeb190d20aab2e017bbad5ecb..a165ab3a387cfd7f219713677de3ad60712832ff 100644 --- a/src/metabase/api/common/internal.clj +++ b/src/metabase/api/common/internal.clj @@ -27,6 +27,27 @@ ;;; | DOCSTRING GENERATION | ;;; +----------------------------------------------------------------------------------------------------------------+ +(defn handle-nonstandard-namespaces + "HACK to make sure some enterprise endpoints are consistent with the code. + The right way to fix this is to move them -- see #22687" + [name] + (-> name + (str/replace #"^metabase\.api\." "/api/") + ;; HACK to make sure some enterprise endpoints are consistent with the code. + ;; The right way to fix this is to move them -- see #22687 + ;; /api/ee/sandbox/table -> /api/table, this is an override route for /api/table if sandbox is available + (str/replace #"^metabase-enterprise\.sandbox\.api\.table" "/api/table") + ;; /api/ee/sandbox -> /api/mt + (str/replace #"^metabase-enterprise\.sandbox\.api\." "/api/mt/") + ;; /api/ee/content-verification -> /api/moderation-review + (str/replace #"^metabase-enterprise\.content-verification\.api\." "/api/moderation-review/") + ;; /api/ee/sso/sso/ -> /auth/sso + (str/replace #"^metabase-enterprise\.sso\.api\." "/auth/") + ;; this should be only the replace for enterprise once we resolved #22687 + (str/replace #"^metabase-enterprise\.serialization\.api" "/api/ee/serialization") + (str/replace #"^metabase-enterprise\.advanced-config\.api\.logs" "/api/ee/logs") + (str/replace #"^metabase-enterprise\.([^\.]+)\.api\." "/api/ee/$1/"))) + (defn- endpoint-name "Generate a string like `GET /api/meta/db/:id` for a defendpoint route." ([method route] @@ -36,20 +57,7 @@ (format "%s %s%s" (name method) (-> (.getName (the-ns endpoint-namespace)) - (str/replace #"^metabase\.api\." "/api/") - ;; HACK to make sure some enterprise endpoints are consistent with the code. - ;; The right way to fix this is to move them -- see #22687 - ;; /api/ee/sandbox/table -> /api/table, this is an override route for /api/table if sandbox is available - (str/replace #"^metabase-enterprise\.sandbox\.api\.table" "/api/table") - ;; /api/ee/sandbox -> /api/mt - (str/replace #"^metabase-enterprise\.sandbox\.api\." "/api/mt/") - ;; /api/ee/content-verification -> /api/moderation-review - (str/replace #"^metabase-enterprise\.content-verification\.api\." "/api/moderation-review/") - ;; /api/ee/sso/sso/ -> /auth/sso - (str/replace #"^metabase-enterprise\.sso\.api\." "/auth/") - ;; this should be only the replace for enterprise once we resolved #22687 - (str/replace #"^metabase-enterprise\.serialization\.api" "/api/ee/serialization") - (str/replace #"^metabase-enterprise\.([^\.]+)\.api\." "/api/ee/$1/")) + handle-nonstandard-namespaces) (if (vector? route) (first route) route)))) diff --git a/src/metabase/cmd/endpoint_dox.clj b/src/metabase/cmd/endpoint_dox.clj index c14a0c485ee5bbaccb8138f0289378fc17d805c5..dc7b29b54e380186f2faec66c8fe4617e58494df 100644 --- a/src/metabase/cmd/endpoint_dox.clj +++ b/src/metabase/cmd/endpoint_dox.clj @@ -29,7 +29,7 @@ (def initialisms "Used to format initialisms/acronyms in generated docs." - '["SSO" "SAML" "GTAP" "LDAP" "SQL" "JSON" "API"]) + '["SSO" "SAML" "GTAP" "LDAP" "SQL" "JSON" "API" "LLM"]) (defn capitalize-initialisms "Converts initialisms to upper case."