Skip to content

Commit

Permalink
iterate-on: add spec and description
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorbin committed Sep 28, 2024
1 parent cf3476e commit 001f81d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/clojure/mirabelle/action.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3019,11 +3019,18 @@
(dissoc source))
children))))))


(s/def :iterate-on/source (s/or :keyword keyword? :vec (s/coll-of keyword?)))
(s/def :iterate-on/destination (s/or :keyword keyword? :vec (s/coll-of keyword?)))

(s/def ::iterate-on (s/cat :config (s/keys :req-un [:iterate-on/source
:iterate-on/destination])))

(defn iterate-on
[config & children]
;(mspec/valid-action? ::extract [k])
(mspec/valid-action? ::iterate-on [config])
{:action :iterate-on
:description {:message "TODO"}
:description {:message (format"Extract the list from source %s and create new events for each element, with the element mapped to the destination %s" (:source config) (:destination config))}
:params [config]
:children children})
Expand Down
2 changes: 2 additions & 0 deletions test/mirabelle/stream_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@
(a/sdissoc [:host :service])
(a/throttle {:count 1 :duration 10})
(a/ewma-timeless 1)
(a/iterate-on {:source [:events]
:destination :event})
(a/over 1)
(a/under 1)
(a/tap :foo)
Expand Down

0 comments on commit 001f81d

Please sign in to comment.