mirror of
https://github.com/penpot/penpot.git
synced 2026-09-13 07:30:24 +00:00
✨ Make the rpc doc generation lazy
This commit is contained in:
parent
9378a5786f
commit
c87fa4f723
@ -86,7 +86,7 @@
|
|||||||
(fn [request]
|
(fn [request]
|
||||||
(let [params (:query-params request)
|
(let [params (:query-params request)
|
||||||
pstyle (:type params "js")
|
pstyle (:type params "js")
|
||||||
context (assoc context :param-style pstyle)]
|
context (assoc @context :param-style pstyle)]
|
||||||
|
|
||||||
{::yres/status 200
|
{::yres/status 200
|
||||||
::yres/body (-> (io/resource "app/templates/api-doc.tmpl")
|
::yres/body (-> (io/resource "app/templates/api-doc.tmpl")
|
||||||
@ -178,7 +178,7 @@
|
|||||||
(fn [_]
|
(fn [_]
|
||||||
{::yres/status 200
|
{::yres/status 200
|
||||||
::yres/headers {"content-type" "application/json; charset=utf-8"}
|
::yres/headers {"content-type" "application/json; charset=utf-8"}
|
||||||
::yres/body (json/encode context)})
|
::yres/body (json/encode @context)})
|
||||||
(fn [_]
|
(fn [_]
|
||||||
{::yres/status 404})))
|
{::yres/status 404})))
|
||||||
|
|
||||||
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
(defmethod ig/init-key ::routes
|
(defmethod ig/init-key ::routes
|
||||||
[_ {:keys [::rpc/methods] :as cfg}]
|
[_ {:keys [::rpc/methods] :as cfg}]
|
||||||
[(let [context (prepare-doc-context methods)]
|
[(let [context (delay (prepare-doc-context methods))]
|
||||||
[["/_doc"
|
[["/_doc"
|
||||||
{:handler (doc-handler context)
|
{:handler (doc-handler context)
|
||||||
:allowed-methods #{:get}}]
|
:allowed-methods #{:get}}]
|
||||||
@ -216,7 +216,7 @@
|
|||||||
{:handler (doc-handler context)
|
{:handler (doc-handler context)
|
||||||
:allowed-methods #{:get}}]])
|
:allowed-methods #{:get}}]])
|
||||||
|
|
||||||
(let [context (prepare-openapi-context methods)]
|
(let [context (delay (prepare-openapi-context methods))]
|
||||||
[["/openapi"
|
[["/openapi"
|
||||||
{:handler (openapi-handler)
|
{:handler (openapi-handler)
|
||||||
:allowed-methods #{:get}}]
|
:allowed-methods #{:get}}]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user