File tree 3 files changed +10
-9
lines changed
test19/compojure/api/coercion
3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 813
813
(static-form? &env form'))))))
814
814
815
815
(defn- constant-form? [&env form]
816
- (or ((some-fn nil? keyword? number? boolean?) form)
816
+ (or ((some-fn nil? keyword? number? boolean? string? ) form)
817
817
(and (seq? form)
818
818
(= 2 (count form))
819
819
(= 'quote (first form)))))
820
820
821
821
(defn- static-binder? [&env bv]
822
822
(and (vector? bv)
823
823
(even? (count bv))
824
- (every? (fn [[_ init]]
825
- (static-body? &env init))
826
- (partition 2 bv))))
824
+ (reduce (fn [&env [l init]]
825
+ (if-not (or (simple-symbol? l)
826
+ (static-form? init))
827
+ (reduced false )
828
+ (assoc &env l true )))
829
+ &env (partition 2 bv))))
827
830
828
831
(defn- static-let? [&env body]
829
832
(and (seq? body)
832
835
(let [v (resolve &env (first body))]
833
836
(when (var? v)
834
837
(contains?
835
- '#{clojure.core/let compojure.api.sweet/let-routes compojure.api.core/let-routes}
838
+ '#{clojure.core/let clojure.core/for
839
+ compojure.api.sweet/let-routes compojure.api.core/let-routes}
836
840
(symbol v)))))
837
- (let [[_ bv & body] body]
841
+ (let [[_ bv & body] ( macroexpand-1 ( list* `let ( next body))) ]
838
842
(and (static-binder? &env bv)
839
843
(static-body? &env body)))))
840
844
Original file line number Diff line number Diff line change 1705
1705
(fact " context"
1706
1706
(let [app (api
1707
1707
(context " /api" []
1708
- :static true
1709
1708
(for [path [" /ping" " /pong" ]]
1710
1709
(GET path [] (ok {:path path})))))]
1711
1710
Original file line number Diff line number Diff line change 39
39
(context " /api" []
40
40
:tags [" api" ]
41
41
:coercion :spec
42
- :static true
43
42
44
43
(context " /jr1" []
45
- :static true
46
44
(resource
47
45
{:get
48
46
{:summary " Number of successful full-text article requests by month and journal"
You can’t perform that action at this time.
0 commit comments