DEV Community

Cover image for PHAISTOS - A generalized data exchange framework and validation tool
George Delaportas (ViR4X)
George Delaportas (ViR4X)

Posted on

PHAISTOS - A generalized data exchange framework and validation tool

PHAISTOS is a platform with which you can create validation models (schemas) for any kind/type of information, structured in JSON, and then share/exchange any data using the predefined model you define.

When sending or receiving, both sides (providers & consumers), can validate the data and make sure it conforms to the original schema as originally defined.

Now, all of that is useful when you have big data platforms acting as data brokers and/or aggregators, because it helps simplify internal operations on data before it reaches storage (like a database).

PHAISTOS is also a good utility that can be used alongside FIWARE.

Finally, with the same logic, you can use it to define confirmation models for functions/methods that have many parameters so that you don't waste infinite time with "if, then, else" so that you make sure the data that are passed arguments have indeed, the correct data type, size, etc.

The only thing that PHAISTOS does not do is to control the logic... Oh and also does not make coffee!
In a future version maybe though! 😛

Here's a real-life example that showcases PHAISTOS functionality.
Image description

We start with: var my_validator = new phaistos();
You will see the model (schema) that I am creating to tell to the system what structure I expect and with what data, size, etc. what are the optional fields and how many are the parameters.

Then, I write the following code to set my definition model to the system: my_validator.define(config_defintion_model);

Finally, I write a configuration that "sits" on the schema. The entire validation process is done by PHAISTOS with:
my_validator.validate(taurus_config);

To do all the above in one line (define and validate) I write:
my_validator.verify(config_defintion_model, taurus_config);

So, practically speaking, we would say that PHAISTOS introduces and reconstructs, peripherally, the logic of a code in a stricter "Design by contract" philosophy, which obviously has much fewer errors.

FYI, the PHAISTOS core and libraries, are part of the micro-MVC framework.

Download PHAISTOS from https://github.com/g0d/PHAISTOS

Top comments (0)