Skip to content
learning locker

Introducing Our New xAPI Statement Factory

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 Pool Learning Record Store
  2. Improved code reuse and maintainability
  3. Allowed us to publish our validation without Learning Pool Learning Record Store 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:[email protected]` should be a valid `LockerXApiMailto` in ``”

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.

Got a learning problem to solve?

Get in touch to discover how we can help

CTA background