Rx: Simple, Extensible Schemata

Terminology

There are really only two things you need to know about in Rx: types and
schemata. A type is an abstract description of a type of data. For
example, "an integer" or "an associative array" are data types. When they're
made into concrete, checkable constraints, they become schemata. This is
done by parameterizing them.

A Rx type is identified by a unique URL, generally in the tag: schema. When writing these in
schema definitions, there is a form of shorthand available. If the string
begins with a slash, it is assumed to be in the format:
/id/rest, where id is in a list of known
identifiers that expand to base URLs.

For example, given this prefix table:

rubric

tag:codesimply.com,2008:rubric/

x

http://example.com/x-ample/

...then type names may be supplied as /rubric/tag or /x/int
instead of tag:codesimply.com,2008:rubric/tag or
http://example.com/x-ample/tag respectively.

The empty prefix is always reserved for the core type tag prefix:

(empty)

tag:codesimply.com,2008:rx/core/

Types located under tag:codesimply.com,2008:rx/core/ are the
core types and must be implemented by all Rx implementations. These
are detailed below. While users can define their own custom types, quite a
lot of data validation rules can be expressed using the core types.

Prefixes starting with a period are reserved for use by Rx. The following
are defined:

.rx

tag:codesimply.com,2008:rx/

.meta

tag:codesimply.com,2008:rx/meta/

This page gives a brief overview of the core types, which will be defined
in detail elsewhere, later.

Single Types

The basic scalar (one-value) types are:

//nil

the lack of a value (undef, null, nil, etc)

//def

any defined value; anything that is not //nil

//bool

a value that is either true or false

//num

a number; may be parameterized by a range

//int

an integer; any number such that (x == floor(x)); may be
parameterized by a range

//str

a string, even the empty string; may require a specific string or be
parameterized by length range