biggusdictus is a powerful library designed to simplify the process of validating dictionaries against specified schemas. Easily generate validation schemes for JSON files and ensure data integrity with customizable constraints, making your data validation robust and straightforward.
biggusdictus is a powerful library designed for validating dictionaries, particularly useful for ensuring the integrity of JSON data. This library simplifies the process of generating validation schemes and validating data against predefined structures.
To validate a dictionary using biggusdictus, simply import the library, create a scheme, and define the expected structure of your data. For instance:
from biggusdictus import *
sche = Scheme()
data = {
"private": False,
"date": "2025-02-22T00:00:00+0000",
"id": 24,
"avg": -24.2,
"name": "user82224",
"badges": ["b1", "b2", 24],
"info": {
"country": "Brazil",
"posts": 421
},
"comments": [
{ "id": 254, "msg": "!!!!!!" },
{ "id": 254, "msg": "------", "likes": -2 }
]
}
sche.dict(
data,
("private", bool),
("date", Isodate),
("id", uint),
("avg", float),
("name", str, 1),
("badges", list, (Or, str, uint)),
("info", dict,
("country", str),
("posts", uint)
),
("comments", list, (dict,
("id", uint),
("msg", str),
(None, "likes", int)
))
)
This example demonstrates how to define a validation scheme by specifying the expected fields, their data types, and additional constraints. If the data does not meet the specified conditions, a DictError() will be raised, allowing for efficient error handling during data processing.
biggusdictus includes a framework for creating custom validation types and constraints by extending the basic functionality. This allows users to tailor the validation process to fit their specific requirements without compromising on performance or usability.
For comprehensive details about all functionalities and capabilities, refer to the complete documentation provided within the repository.
No comments yet.
Sign in to be the first to comment.