Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwrapping data-specs from specs (created from data-specs) #111

Open
ikitommi opened this issue Mar 16, 2018 · 1 comment
Open

Unwrapping data-specs from specs (created from data-specs) #111

ikitommi opened this issue Mar 16, 2018 · 1 comment

Comments

@ikitommi
Copy link
Member

Currently, data-specs is a one way transformation: you define them and compile them into real specs. Would be great to be able to extract the original data-spec source and options from compiled specs. Like spec-of-specs, but for data-specs.

something like:

(require '[spec-tools.data-spec :as ds])

(def ds {:name string?, :age int?})

(def spec (ds/spec {:name ::some, ::spec ds}))

(assert (= ds (ds/unspec spec)))
@ikitommi
Copy link
Member Author

or maybe:

(require '[spec-tools.data-spec :as ds])

(def ds {:name string?, :age int?})

(def spec (ds/spec {:name ::some, ::spec ds}))

(def spec2 (ds/update spec (fn [ds] (assoc ds :address {:street string?}))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant