handler-source reconstructs defhandler form instead of dumping dict
Builds (defhandler name :path ... :method ... params body) from the handler dict fields and pretty-prints it with syntax highlighting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,14 +25,30 @@
|
||||
(name)
|
||||
(let
|
||||
((handler-key (str "handler:" name))
|
||||
(val
|
||||
(hdef
|
||||
(cek-try
|
||||
(fn () (eval-expr (make-symbol handler-key)))
|
||||
(fn (err) nil))))
|
||||
(if
|
||||
(not (nil? val))
|
||||
(pretty-print val)
|
||||
(str ";;; Handler not found: " name)))))
|
||||
(nil? hdef)
|
||||
(str ";;; Handler not found: " name)
|
||||
(let
|
||||
((method (or (get hdef "method") "get"))
|
||||
(path (get hdef "path"))
|
||||
(csrf (get hdef "csrf"))
|
||||
(returns (or (get hdef "returns") "element"))
|
||||
(params (or (get hdef "params") (list)))
|
||||
(body (get hdef "body")))
|
||||
(pretty-print
|
||||
(list
|
||||
(make-symbol "defhandler")
|
||||
(make-symbol name)
|
||||
:path path
|
||||
:method (make-keyword method)
|
||||
:csrf csrf
|
||||
:returns returns
|
||||
params
|
||||
body)))))))
|
||||
|
||||
(define _spec-dirs (list "spec" "web" "shared/sx/ref" "lib"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user