←back to thread

Parse, Don't Validate (2019)

(lexi-lambda.github.io)
389 points melse | 2 comments | | HN request time: 0.414s | source
Show context
Attummm ◴[] No.27640130[source]
That's how the validation tool for Python Maat works. By creating a completely new dictionary. https://github.com/Attumm/Maat
replies(2): >>27640197 #>>27640762 #
mulmboy ◴[] No.27640762[source]
How does Maat compare with pydantic? https://github.com/samuelcolvin/pydantic
replies(2): >>27640874 #>>27640983 #
1. Attummm ◴[] No.27640983[source]
Pydantic is using classes and typehinting. The new dataclasses style. Currently Maat doens't have a parser for dataclasses, it could come in the future. Pydantic works great with typehinting.

Maat was created before dataclasses existed. For validation Maat offers the same. But it also allows for some really neat features such as validation on encrypted data. https://github.com/Attumm/Maat/blob/main/tests/test_validati...

Since validation is written as dictionaries its possible to store the validations in caching db such as Redis.

And since its simple its easy to extend for anyone use case. And there are no other dependencies.

Benchmarks of pydantic has Maat around twice as Pydantic.

replies(1): >>27646242 #
2. Attummm ◴[] No.27646242[source]
Unable to change my comment.

Benchmarks of pydantic has Maat around twice the speed of Pydantic