breaking: widen spec for ingress usage

pull/1/head
jerger 1 year ago
parent 167c58be08
commit 2c8ce98d66

@ -7,7 +7,6 @@
:cljs [orchestra.core :refer-macros [defn-spec]])
[dda.c4k-common.predicate :as cp]))
;; deprecated functions were moved to dda.c4k-common.predicate
(defn ^{:deprecated "0.1"} bash-env-string?
[input]
@ -26,7 +25,7 @@
(defn-spec replace-named-value cp/map-or-seq?
[coll cp/map-or-seq?
name string?
value string?]
value cp/str-or-number?]
(clojure.walk/postwalk #(if (and (map? %)
(= name (:name %)))
{:name name :value value}
@ -36,7 +35,7 @@
(defn-spec replace-key-value cp/map-or-seq?
[coll cp/map-or-seq?
key keyword?
value string?]
value cp/str-or-number?]
(clojure.walk/postwalk #(if (and (map? %)
(contains? % key))
(assoc % key value)
@ -46,7 +45,7 @@
(defn-spec replace-all-matching-values-by-new-value cp/map-or-seq?
[coll cp/map-or-seq?
value-to-match string?
value-to-replace string?]
value-to-replace cp/str-or-number?]
(clojure.walk/postwalk #(if (and (= (type value-to-match) (type %))
(= value-to-match %))
value-to-replace
@ -58,7 +57,10 @@
(into []
(apply concat vs)))
(defn generate-common [my-config my-auth config-defaults k8s-objects]
(defn generate-common
[my-config
my-auth
config-defaults k8s-objects]
(let [resulting-config (merge config-defaults my-config)]
(cs/join
"\n---\n"

@ -28,7 +28,8 @@
(defn map-or-seq?
[input]
(or (map? input) (seq? input)))
(or (map? input)
(seq? input)))
(defn pvc-storage-class-name?
[input]
@ -65,3 +66,9 @@
(and (int? input)
(> input n)))
(defn str-or-number?
[input]
(or
(string? input)
(number? input)))

@ -72,3 +72,8 @@
(is (cut/int-gt-n? 5 6))
(is ((partial cut/int-gt-n? 5) 10))
(is (not ((partial cut/int-gt-n? 5) 4))))
(deftest test-str-or-number?
(is (cut/str-or-number? "string"))
(is (cut/str-or-number? 42))
(is (not (cut/str-or-number? []))))

Loading…
Cancel
Save