Skip to content
Snippets Groups Projects
Unverified Commit 3febfbf4 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Fix LSP for defendpoint (#47641)

parent bf67dbf9
No related branches found
No related tags found
Loading
......@@ -19,29 +19,14 @@
(-> (api/list-node
(list
(api/token-node 'do)
(api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(-> (api/list-node
(list*
(api/token-node 'clojure.core/defn)
(api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
body))
(with-meta (meta node)))))
(-> (api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(with-meta (meta method)))
(api/list-node
(list*
(api/token-node 'clojure.core/defn)
(-> (api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
(with-meta (meta route)))
body))))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))]
(update arg :node update-defendpoint)))
(comment
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
defendpoint
:node
api/sexpr))
(ns hooks.metabase.api.common-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.api.common]))
(deftest ^:parallel defendpoint-test
(is (= '(do
compojure.core/POST
(clojure.core/defn
POST_:id_copy
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*))))))
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
hooks.metabase.api.common/defendpoint
:node
api/sexpr))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment