I’m happy to announce the first release of the ParamProcessor library.
ParamProcessor is a parameter processing library that provides a way to decoratively define a set of parameters and how they should be processed. It can take such declarations together with a list of raw parameters and provide the processed values. For example, if one defines a parameter to be an integer, in the range [0, 100], then ParamProcessor will verify the input is an integer, in the specified range, and return it as an actual integer variable.
Sounds familiar? It should if you’ve used my Validator MediaWiki extension. This new library is essentially the guts of the Validator extension, separated, dusted off and made independent of MediaWiki.
Quite a few changes have been made since the Validator 0.5 release, which are currently detailed in the Validator release notes. The changes mainly focused on cleaning up the code and tackling a number of design issues. Perhaps the most important one being the lack of clear public interfaces. Thus a big goal of this release is to prevent exposing internal details to consumers, which causes tight coupling and fragility. Another area of focus was stability. For this, a lot of tests where added. Like with the other quality issues in the library, there is still quite some room for improvement in the area of tests. ParamProcessor is currently at 47% unit test coverage, which is up from 0% at the point of the Validator 0.5 release. The next releases are likely to be smaller, more frequent, and largely continue in the spirit of this one.
More frequent releases are now made a lot easier, as the bulk of the code is in a library, rather than a MediaWiki extension, is well tested, and typically consumed via Composer. The Composer package is named param-processor/param-processor, and has currently over 3000 downloads on Packagist.
There is some documentation on how to use it, though at this point it is really insufficient. This has been the case since I changed how parameters are defined, many months back. I’m planning to at least improve upon the current state of the documentation before the SMW 1.9 release, which is scheduled for next month.
The main reason I’m releasing this library now is that the lack of any recent releases was blocking releases of its consumers, in particular those of Semantic MediaWiki and Maps. A second factor is that in very similar fashion, the ParamProcessor library itself was blocked from being released due to the lack of any stable release of the DataValues library, which finally got solved last weekend. This means that for the next releases of Maps and SMW, which will be Composer based, you’ll be using version 1.0 (or later) of this library.
Fun fact: this release has been made exactly one year after the previous release of Validator (0.5.1).