Talltale
A Clojure/ClojureScript Fake Data Generator Library
Install / Use
/learn @jgrodziski/TalltaleREADME
Talltale
Talltale is a Clojure(Script) library that generates fake data, useful for prototyping or load testing. Can be used with clojure.spec for instance.
Talltale provides traditional Clojure's functions that generates values but also test.check/clojure.spec generators (with -gen suffix). The date objects used are Java Time objects (version 0.3.0) instead of Joda Time.
I was inspired by the JFairy lib (I actually copied the nice data used by their generators).
Installation
Declare the lib dependency in your deps.edn:
talltale/talltale {:mvn/version "0.5.14"}
Declare the lib dependency in Leiningen:
[talltale "0.5.14"]
Usage
Require the core namespace, every generators is merged into the core namespace for convenience.
(use '[talltale.core])
(company :fr)
;; => {:address {:city "Le Perreux-sur-Marne", :postal-code "10000",
;; :street "Grande Rue", :street-number 1},
;; :domain "buapel.com", :email "ventes@buapel.com", :full-name "Buapel Ltd",
;; :identification-number "00000001",
;; :logo-url "http://via.placeholder.com/350x150?text=Buapel", :name "Buapel",
;; :org-id "BUAPEL", :phone-number "0100000000", :tld "com", :type "Ltd",
;; :url "https://www.buapel.com"}
(company);; default is always :en locale
;; => {:address {:city "Miami", :postal-code "10076", :street "Ford Street",
;; :street-number 233},
;; :domain "adapt.com", :email "contact@adapt.com",
;; :full-name "Adapt Associates", :identification-number "12-0000016",
;; :logo-url "http://via.placeholder.com/350x150?text=Adapt", :name "Adapt",
;; :org-id "ADAPT", :phone-number "124-124-0124", :tld "com",
;; :type "Associates", :url "https://www.adapt.com"}
(person)
;; => {:address {:city "San Francisco", :postal-code "10000",
;; :street "Summer Place", :street-number 1},
;; :age 37,
;; :password "62x4awex6m32s",
;; :date-of-birth #object[org.joda.time.LocalDate 0x7d24c344 "1981-01-08"],
;; :email "shannon@yahoo.com", :first-name "Khloe", :last-name "Shannon",
;; :phone-number "122-122-122",
;; :picture-url "https://randomuser.me/api/portraits/women/4.jpg", :sex :female,
;; :username "khloe"}
(username (first-name) (last-name))
(age);; => 56
(-> age date-of-birth);; => return a LocalDate object on JVM or cljs-time on JS
(first-name :fr);;random considering the gender (frequency 0f 0.5 for both)
(first-name-male :en);;=> "Logan"
(email (first-name) (last-name) );; =>
(picture-url :female)
;;you got the test.check generator version
(gen/sample (person-gen))
(address);; => {:city "San Francisco", :postal-code "10000",
;; :street "Summer Place", :street-number 1}
(address-gen);; => return a Generator
(phone-number);;=> "124-124-0124"
(company-gen);; => return a Generator
(gen/sample (company-gen))
(lorem-ipsum)
(text)
Notes: I use test.check generators for numbers, so don't be surprised by the value as they respect the "Growth and Shrink" manner of test.check.
All available generators
(keys (ns-publics 'talltale.core))
;; Common
(text)
(lorem-ipsum)
;; Address
(street-number)
(street)
(postal-code)
(city)
(phone-number)
(address)
;; Company
(org-id)
(company-name)
(company-type)
(function)
(email)
(full-name)
(company-email)
(identification-number)
(tld)
(domain)
(url)
(logo-url)
(company)
;; Person
(sex)
(username)
(password)
(first-name)
(first-name-male)
(first-name-female)
(last-name)
(last-name-male)
(last-name-female)
(age)
(date-of-birth)
(position)
(picture-url)
(person-male)
(person-female)
(person)
;;various generator
(quality)
;; => "robust" "unreal" etc.
(shape)
;; => "circular" "oval"
(color)
;; => "blue" "rose"
(animal)
;; => "horse" "koala"
(landform)
;; => "moulin" "cave"
Remember that you can just add the -gen suffix to get a test.check/clojure.spec generator and then use it with gen/sample.
Also each function/generator accept a locale as first argument with :en and :fr as the first ones provided.
ClojureScript
If you want to try Talltale with Planck:
planck -D talltale:0.2.11,com.andrewmcveigh/cljs-time:0.5.2,org.clojure/test.check:0.10.0-alpha2
then
(require 'talltale.core)
(in-ns 'talltale.core)
License
Copyright © 2019 Jeremie Grodziski
Distributed under the Eclipse Public License either version 1.0.
Related Skills
gh-issues
341.6kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
341.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
84.6kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
