{"id":20994946,"url":"https://github.com/elliotgao2/xdata","last_synced_at":"2025-08-01T11:15:42.900Z","repository":{"id":57497493,"uuid":"84461159","full_name":"elliotgao2/xdata","owner":"elliotgao2","description":"Data validator for the zen of python","archived":false,"fork":false,"pushed_at":"2017-03-29T02:59:46.000Z","size":771,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-03T02:08:06.846Z","etag":null,"topics":["data-validation","datatype","marshalling","python","serialization","validation","validator","xdata"],"latest_commit_sha":null,"homepage":"https://gaojiuli.github.io/xdata/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elliotgao2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T16:02:00.000Z","updated_at":"2024-10-26T14:22:15.000Z","dependencies_parsed_at":"2022-09-03T23:52:27.353Z","dependency_job_id":null,"html_url":"https://github.com/elliotgao2/xdata","commit_stats":null,"previous_names":["elliotgao2/xdata","gaojiuli/xdata"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotgao2%2Fxdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotgao2%2Fxdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotgao2%2Fxdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotgao2%2Fxdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliotgao2","download_url":"https://codeload.github.com/elliotgao2/xdata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254230802,"owners_count":22036246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-validation","datatype","marshalling","python","serialization","validation","validator","xdata"],"created_at":"2024-11-19T07:20:41.423Z","updated_at":"2025-05-14T21:30:53.586Z","avatar_url":"https://github.com/elliotgao2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XData\n\n![[Build](https://travis-ci.org/gaojiuli/xdata)](https://travis-ci.org/gaojiuli/xdata.svg?branch=master)\n![[License](https://pypi.python.org/pypi/xdata/)](https://img.shields.io/pypi/l/xdata.svg)\n![[Pypi](https://pypi.python.org/pypi/xdata/)](https://img.shields.io/pypi/v/xdata.svg)\n![[Python](https://pypi.python.org/pypi/xdata/)](https://img.shields.io/pypi/pyversions/xdata.svg)\n\nA simple but useful library for validating data.\n\n## Features\n\n- Easy to use, only one step\n- Easy to extend\n- No dependencies\n\n## Required\n\n- python \u003e= 3.5\n\n## Installation\n\n`pip install xdata`\n\n## Usage\n\n### ValidatedData\n\n```python\nfrom xdata.schema import Schema\nfrom xdata.types import *\n\n\nclass UserSchema(Schema):\n    telephone = Str(length=11, required=True)\n    password = Str(min_length=8,max_length=16, required=True)\n    \nrequest_data = {\n    'telephone':'18180050000',\n    'password':'idonotknow'\n}\n\nschema = UserSchema(request_data)\nif schema.valid:\n    print(schema.validated_data) # {'telephone': '18180050000', 'password': 'idonotknow'}\n\n```\n\n### Errors\n\n```python\nfrom xdata.schema import Schema\nfrom xdata.types import *\n\nclass UserSchema(Schema):\n    telephone = Str(length=11, required=True)\n    password = Str(min_length=8, max_length=16, required=True)\n\n\nrequest_data = {}\n\nschema = UserSchema(request_data)\nif not schema.valid:\n    print(schema.errors)  # {'telephone': 'telephone is required', 'password': 'password is required'}\n```\n\n### DataTypes\n\n```python\nfrom xdata.schema import Schema\nfrom xdata.types import *\n\nDataType(required=True,default='11',choices=[])\n\nStr(length=11, max_length=12,min_length=10,regex=\"\")\nInt(max=10000,min=12)\nBool(max=10000,min=12)\nDecimal(left=5,right=2)\nDateTime(max_datetime='2001-01-01 00:00:00', min_datetime='2000-01-01 00:00:00')\nDate(max_date='2001-01-01', min_date='2000-01-01')\nTime(max_time='06:00:00', min_time='05:00:00')\n\n```\n\n## Test\n\n`coverage run --source=xdata -m pytest \u0026\u0026 coverage report`\n\n\n## Todos\n\n1. More DataTypes\n2. More Check rules\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotgao2%2Fxdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliotgao2%2Fxdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotgao2%2Fxdata/lists"}