Trying Aontu After Using JSON Schema, Zod, and Pydantic
I use Zod and Pydantic often, so when I started reading about Aontu, I had a basic question: why would I learn another language for defining data? JSON Schema can define the structure of JSON data and validate it. So I tried Aontu locally to understand it better. Starting with a simple config I created a small service config: service: close({ name: string host: *localhost | string port: *8080 |…
Aontu is a data validation tool that offers features beyond what JSON Schema can provide. The author tried Aontu after using JSON Schema and found it useful in certain scenarios. JSON Schema is great for simple validation of JSON data, but Aontu allows for unification of rules, defaults, and values in one model. This means that rules, defaults, and actual values can coexist within the same model, making it easier to maintain and check the data.
Aontu also provides a feature called "model why" which helps in finding out where a specific value came from and which rules were applied to it. This can be particularly helpful in large projects with multiple configurations (development, production, etc.). Aontu can also define and check relations between different parts of a system, which is more complex than what JSON Schema can handle.
For instance, it can detect cycles in service dependencies. This is useful for maintaining the integrity of the system. Another benefit is its ability to handle configuration for different environments, such as base and production configs, without repeating the same rules. Finally, Aontu can be used by coding agents to check their changes against the defined rules, ensuring that the system remains consistent.
However, Aontu may not be the best choice for simple request validation and is more suited for projects with multiple rules and dependencies. The syntax may take some time to get used to, but the added features make Aontu a valuable tool for complex systems.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.