A data structure processing library - validation, response or message generation, etc.; inspired by Metis.
Clojure HTML
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/themis
test/themis
.gitignore
README.mkd
guide.mkd
license_epl.html
project.clj

README.mkd

Themis

A data structure processing library - validation, response or message generation, etc.

It started life as a validation library for Clojure, born out of my experience trying to use other validation libraries.

Overview

For the latest release information, please see the Clojars entry

  • Supported Clojure versions
    • Developed with 1.5.1 but should work down to 1.2

Artifacts

If you are using Maven, add the following repository definition to your pom.xml:

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>

The Most Recent Release

With Leiningen:

[ohpauleez/themis "0.1.2"]

With Maven:

<dependency>
  <groupId>ohpauleez</groupId>
  <artifactId>themis</artifactId>
  <version>0.1.2</version>
</dependency>

Project goals

Themis aims to provide a way to process data structures and dispatch actions based on the data within a data structure.

Prismatic's graph offers a way to specify and structure computations. I am more often faced with a scenario that I'm handed a specifc piece of data (say, a hash-map), and need to perform specific actions with individual pieces of that data structure. Usually those actions are unrelated and I'd like to perform them in parallel.

One instance of this is validation. It is also sometimes the case that validation goes beyond syntactic checks (ie: a string is of a certain length), and pushes into semantic validation (ie: the address you are modeling is a real address). In many cases, semantic validation requires calling a third party service or library.

I wrote Themis first as a validation library, and later found it useful for generating response messages and data. I use the term "validation" very loosely throughout this README.

Why another validation library?

  1. The validation rule set should be expressed as data. Rule sets should be able to completely serialize to EDN.
  2. Validators should always resolve to something that supports IFn. The resolution of data to IFn-ables happens at validation time.
  3. Applying validation should be nothing more than applying functions and seq'ing the results together.
  4. Validation is often domain specific, and the library should be open for modification to easily adapt to different requirements.
  5. Validation results should not be conj'd/merge'd onto the original data (unless the user specifically did that).
  6. Validation rule sets should allow for proper namespacing of validators (symbols/functions/etc) and general data.

Assumptions and expectations

Themis attempts to make no assumptions about the data structure you're validating, the results your validator functions return, or how you want to package up the results of a full validation.

When assumptions are made, there is always an escape hatch allowing you to modify the behavior to better suit your application needs.

Why the name Themis?

I was originally using metis, a validation library named after Zeus' first wife. So, I naturally named mine after Zeus' second wife.

Where can I find more documentation

See this project's guide

Usage

There is a lot covered in the Marginalia docs, API docs, and in the guide.

Also, see the embedded examples

License

Copyright © 2014 Paul deGrandis

Distributed under the Eclipse Public License, the same as Clojure.