Milt Reder By Milt Reder • June 3, 2015

Announcing xapi-schema

By Jason Lewis and Milt Reder

We love the Experience API. We also love Clojure.

We love Clojure:

We really love that last bit... so much so that we couldn't keep it to ourselves: Today we are happy to announce the release of our xapi-schema library for Clojure(Script) and JavaScript.

Statement Schema

xapi-schema provides a schema that describes an xAPI statement conforming with the latest (presently 1.0.3) version of the specification.

This statement schema is composed of sub-schemata for statement components, keys and values that can be used individually or composed into new schemata.

(Beyond) Validation

Clojure(Script) and JavaScript functions are provided for validation of single/multiple statement data in JSON, edn, or JSON strings.

Errors can be thrown as exceptions, or returned as plain data that maintains the same shape as the data submitted for validation. The errors->data function provides additional internationalization and localization of errors using tower.

Elegant validation and error processing, while useful, are just the tip of the iceberg... The Schema library provides facilities for type hinting, function argument validation, and even transformation/coercion of data. Our schemata can be used for any of these.


We made a small demo application to showcase xapi-schema's validation functionality. Try modifying the provided statement or pasting in your own data to see the validations in action. Source for the demo can be found here.

Use Cases

It is our hope that xapi-schema will help developers bootstrap new projects in Clojure(script) and JavaScript across the xAPI ecosystem. With flexible validation and comprehension of statement data in hand, developers can build:

  • LRS applications with thorough validation and rich error information
  • Activity Provider applications that reliably return valid xAPI data
  • Integrations with existing applications that leverage xapi-schema to transform data from any domain into xAPI statements

Now Available on Github

The xapi-schema library is available now on Github under the Eclipse Public License. Documentation is available, and we are happy to receive issues and pull requests.

Additional Resources

If you haven't tried Clojure before, we can't recommend it highly enough. Here are some good places to get started:

Subscribe for Weekly Updates

Posts by Tag

see all

Popular Posts