lucywang000 / clj-statecharts

State Machine and StateCharts for Clojure(Script)
https://lucywang000.github.io/clj-statecharts/
Eclipse Public License 1.0
231 stars 15 forks source link

Allow extra keys on machine #11

Closed ikitommi closed 2 years ago

ikitommi commented 2 years ago

Currently, on can't add custom keys to machine, the following fails on extra key:

(def machine
  (fsm/machine
   {:id :lights
    :initial :red
    :context nil
    :states {:green {:description "Green Light" ;; fail
                     :on {:timer {:target :yellow}}}
             :yellow {:on {:timer :red}}
             :red {:on {:timer :green}}}
    :on {:power-outage :red}}))

Proposal: either make the schemas always open for extension or option to make them.

lucywang000 commented 2 years ago

Make sense! I just removed the {closed: true} options for all map schemas.

lucywang000 commented 2 years ago

A new version 0.1.5 is released with this change.

ikitommi commented 2 years ago

awesome, thanks!