Introducing Our New xAPI Statement Factory

19 December 2014 by Ryan Smith

If you’ve read Ben’s previous blog post, you’ll know that we’ve been working hard to improve our conformance. You’ll be happy to know that we’re now in the process of testing our issue/conformance branch on Github and making a new release. We’ve also reported the issues that we had with the xAPI test suite on Github and those are now being resolved.

Whilst we were improving our conformance, we decided to refactor our statement validator. The refactoring process has:

  1. Fixed a small bug in Learning Locker
  2. Improved code reuse and maintainability
  3. Allowed us to publish our validation without Learning Locker via Packagist
  4. Improved our validation messages

Our new validation has been tested against the xAPI test suite, all of the examples given by the specification, and our own test suite. Whilst the first two benefits are great, the last two are more interesting to the community.

Our new Statement Factory suite allows you to validate your xAPI statements outside of Learning Locker – you can even validate pre-constructed JSON statements. Activity Providers looking to generate xAPI statements will find this a useful debugging tool to iron out any problems with a statement’s structure prior to deploying to an LRS.

Our validation messages have been sprinkled with awesomeness this festive season. Our new messages are intuitive and more traceable than ever before. With every message we provide you with three pieces of information:

  • What Learning Locker actually received
  • What Learning Locker expected to receive
  • Where the problem is

Here are a few (slightly contrived) examples:

  • “`Agen` (LockerXApiElement) is not a valid `objectType` in `LockerXApiAuthority`. Acceptable types are `[“Agent”,”Group”]` in `statement.authority`”
  • “Unknown properties [“name”,”mbox”,”objectType”] from `LockerXApiElement` in `statement.authority`”
  • “`+100` should be a valid `LockerXApiLanguage` in `statement.verb.display`”
  • “`mailt:duy.nguyen@go1.com.au` should be a valid `LockerXApiMailto` in `statement.actor.mbox`”

Next Steps

As I previously said, we’re now in the process of testing and making a new release (in the next week or two) from the issue/conformance branch (this will be merged into develop soon). We’d be grateful for your feedback as always via Github, the Google Group, and Gitter.

blank
Ryan Smith
Software Development Team Lead

Starting as a placement student in 2014, Ryan re-joined the Learning Locker team after graduating from Oxford Brookes University where he won the John Birch prize for the highest grade average in the University.

From his minimalist desk, Ryan leads the Learning Locker team and consults with people on all things xAPI to conscientiously craft products and services that sustain and evolve training and performance.

When he’s not swimming or injuring himself on the cricket field, Ryan enjoys playing funny (and usually inappropriate) games with his family.

View more from Ryan Smith
blank
Read more about Learning Pool
Visit our Learn and Connect section

Get a free demo

Get in touch to find out how we can help

Start your learning journey

Get started by telling us what you need and one of our team will be in touch very soon.