{"id":23948572,"url":"https://github.com/propan/formar","last_synced_at":"2026-05-13T01:35:02.316Z","repository":{"id":11308183,"uuid":"13725591","full_name":"propan/formar","owner":"propan","description":"a form tranformation/validation library","archived":false,"fork":false,"pushed_at":"2013-12-14T18:20:27.000Z","size":180,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-05-06T18:16:48.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/propan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-20T19:45:15.000Z","updated_at":"2014-11-11T22:02:18.000Z","dependencies_parsed_at":"2022-08-25T11:02:06.108Z","dependency_job_id":null,"html_url":"https://github.com/propan/formar","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/propan/formar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fformar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fformar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fformar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fformar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propan","download_url":"https://codeload.github.com/propan/formar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fformar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32964052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"ssl_error","status_checked_at":"2026-05-12T23:30:18.191Z","response_time":102,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-06T10:19:32.573Z","updated_at":"2026-05-13T01:35:02.298Z","avatar_url":"https://github.com/propan.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# formar\n\nA Clojure library that helps to transform and validate http forms.\n\n## Usage\n\nInclude the library in your leiningen project dependencies:\n\n```clojure\n[formar \"0.1.2\"]\n```\n\n## Examples\n\n```clojure\n(ns your-namespace\n  (:require [formar.core :refer [defform email pattern required]]))\n\n(defform registration-form\n         [[[:username required (pattern #\"^[a-zA-Z0-9_]+$\")]\n           [:email required email]\n           [:password required]]])\n\n(print (registration-form {\"username\" \"dale\" \"email\" \"email\" \"bad-data\" \"bad-value\"}))\n\n;; {:data {:password nil, :email email, :username dale},\n;;  :data-errors {:password is required, :email is not a valid email},\n;;  :form-errors []}\n\n(defform login-form\n         [[[:username required (pattern #\"[a-zA-Z]+\" :msg-fn (constantly \"Only [a-zA-Z] characters are allowed!\"))]\n           [:password (required :message \"Password is required!\")]]])\n\n(print (login-form {\"username\" \"da-le\" \"email\" \"email\" \"bad-data\" \"bad-value\"}))\n\n;; {:data {:password nil, :username da-le},\n;;  :data-errors {:password Password is required!, :username Only [a-zA-Z] characters are allowed!},\n;;  :form-errors []}\n```\n\n### Validation of dependant fields\n\nIf you need to check that a few dependant fields comply with certain rules, you can define a function that takes\nthe result of all field transformations and returns a result of it's own checks/transformations. You can apply\nas many \"form\" transformers as you like.\n\nImportant:\n  - Form transformers are applied only if previous field transformations detected no errors!\n  - Execution of multiple form transformers is interrupted when any of them triggers error state.\n\n```clojure\n(ns your-namespace\n  (:require [formar.core :refer [defform required]]))\n\n(defn passwords-match\n  [m]\n  (let [{:keys [password repeat-password]} (:data m)]\n    (if-not (= password repeat-password)\n      (update-in m [:form-errors] conj \"Passwords don't match!\")\n      m)))\n\n(defform registration-form\n  [[[:username required (pattern #\"^[a-zA-Z0-9_]+$\")]\n    [:password required]\n    [:repeat-password required]]\n   [passwords-match]])\n\n(print (registration-form {\"username\" \"dale\" \"password\" \"pass\" \"repeat-password\" \"word\"}))\n\n;; {:data {:repeat-password word, :password pass, :username bob}, :data-errors {}, :form-errors [Passwords don't match!]}\n```\n\nYou can also use functions that take more than one argument, but the first argument have to be the map to be transformed.\n\n```clojure\n(defform registration-form\n  [[[:username required (pattern #\"^[a-zA-Z0-9_]+$\")]\n    [:password required]\n    [:repeat-password required]]\n   [(update-in [:form-errors] conj \"Error message!\")]])\n\n(print (registration-form {\"username\" \"dale\" \"password\" \"pass\" \"repeat-password\" \"word\"}))\n\n;; {:data {:repeat-password word, :password pass, :username bob}, :data-errors {}, :form-errors [Error message!]}\n```\n\n## License\n\nCopyright © 2013 Pavel Prokopenko\n\nDistributed under the Eclipse Public License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fformar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropan%2Fformar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fformar/lists"}