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

Welcome :re schemas! #67

Merged
merged 3 commits into from
Sep 12, 2019
Merged

Welcome :re schemas! #67

merged 3 commits into from
Sep 12, 2019

Conversation

ikitommi
Copy link
Member

@ikitommi ikitommi commented Sep 11, 2019

(def Email 
  [:re #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$"])

(m/validate Email "[email protected]")
; => true

(-> Email (m/serialize) (m/deserialize) (m/validate "[email protected]"))
; => true

(mg/generate Email {:seed 42, :size 10})
; => "[email protected]"

Question: Should the Pattern implement IntoSchema so it could be used without the:re schema tag? Would be always on...

@ikitommi
Copy link
Member Author

ikitommi commented Sep 11, 2019

ClojureScript doesn't support generating from regexs: gfredericks/test.chuck#46 :(

@ikitommi ikitommi merged commit 2de64e3 into master Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant