Skip to main content

A new guide is available on adding custom plugins to validators to extend their validation capabilities

Validator plugin guide

Published on: 09/09/2022 News

The Test Bed team has published a detailed guide on how to create plugins for validators, an advanced feature used to extend a validator’s capabilities with custom validation logic.

ITB logo

The Test Bed’s validators for XML, RDF, JSON and CSV content are popular components providing data validation and quality assurance either as standalone services or as part of complete conformance testing scenarios. Their setup is configuration-driven, with several deployment options, ranging from use “as-a-service” to flexible on-premise installations.

A key benefit in using the Test Bed’s validators is that there is no need for users to develop and maintain code. The focus is placed on validation artefacts and a flexible configuration that covers most use cases in terms of organising validation profiles and customising exposed APIs. Over several releases, validators have expanded their capabilities with more advanced features such as user-provided validation artefacts and pre-processing of input, allowing them to address even further use cases. All such features share a common trait: they are realised by the validators’ reusable core maintained by the Test Bed team, requiring only configuration from users.

The validators’ built-in features nonetheless have their limits. In terms of the validation rules applied, validators are constrained by the validation technology associated to their target syntax. For example, validation in the JSON validator uses JSON Schemas, whereas the RDF validator uses SHACL shapes. Rules that go beyond the capabilities of such technologies would require a different approach and potentially a custom implementation. A simple example is the need to report a warning if the provided input exceeds a given size threshold, a simple assertion that no syntax-specific validation technology can directly handle.

To address such scenarios, all validators foresee the possibility of configuring custom plugins as extensions to their capabilities. Plugins are called by their validator with standard inputs, such as the received content and the selected validation profile, and produce findings to include in the overall validation report. Apart from implementing a standard API, plugins can be as complex as needed and address any kind of validation, thus expanding limitlessly a validator’s potential. Plugins are fully self-contained, allowing them to be reused across validators and even be contributed by other parties.

Although plugins have been successfully used by the Test Bed team in several validators, they remain a niche feature for most users. To better document them, the Test Bed team has now made available a detailed guide that explains how plugins work, before providing a step-by-step tutorial to develop and use a simple example.

Validator plugin guide

Apart from publishing this latest guide, the Test Bed team has also shared on GitHub a complete plugin example that developers can clone and experiment with. This example illustrates how to create a plugin, but can also be used as the starting point to develop new plugins for specific validators. Furthermore, it is interesting to note that this sample is the result of the new guide’s tutorial, in which the reasoning and further considerations behind each step are covered in depth.

Sample plugin on GitHub

Custom validator plugins are an advanced feature that allows the Test Bed’s validators to cover scenarios that would otherwise not be possible. With the new detailed guide and sample implementation, users outside the Test Bed team can now also benefit from plugins to extend their own validators’ capabilities.

Details on the use and configuration of validators can be found in their respective guides (see for XML, RDF, JSON and CSV cases), which is also the best place to start if you need validation services but have never used a validator before. If you are new to the Test Bed as a whole, general details can be found in its Joinup space with its value proposition being a good starting point for newcomers. Finally, if you are interested in receiving the Test Bed’s news, apart from subscribing to notifications, you may also follow the Interoperable Europe’s social media channels (Twitter, LinkedIn) for updates on the Test Bed and other interoperability solutions.

Login or create an account to comment.

Referenced solution