forked from loafle/openapi-generator-original
[Clojure] Add util method to set the api-context globally (#93)
This commit is contained in:
parent
d890d733f8
commit
d7e374504f
@ -24,6 +24,11 @@
|
|||||||
"Dynamic API context to be applied in API calls."
|
"Dynamic API context to be applied in API calls."
|
||||||
default-api-context)
|
default-api-context)
|
||||||
|
|
||||||
|
(defn set-api-context
|
||||||
|
"Set the *api-context* globally"
|
||||||
|
[new-context]
|
||||||
|
(alter-var-root #'*api-context* (constantly (merge *api-context* new-context))))
|
||||||
|
|
||||||
(defmacro with-api-context
|
(defmacro with-api-context
|
||||||
"A helper macro to wrap *api-context* with default values."
|
"A helper macro to wrap *api-context* with default values."
|
||||||
[api-context & body]
|
[api-context & body]
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
"Dynamic API context to be applied in API calls."
|
"Dynamic API context to be applied in API calls."
|
||||||
default-api-context)
|
default-api-context)
|
||||||
|
|
||||||
|
(defn set-api-context
|
||||||
|
"Set the *api-context* globally"
|
||||||
|
[new-context]
|
||||||
|
(alter-var-root #'*api-context* (constantly (merge *api-context* new-context))))
|
||||||
|
|
||||||
(defmacro with-api-context
|
(defmacro with-api-context
|
||||||
"A helper macro to wrap *api-context* with default values."
|
"A helper macro to wrap *api-context* with default values."
|
||||||
[api-context & body]
|
[api-context & body]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user