DEV Community

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

Posted on

1

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

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry πŸ•’

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more β†’

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay