{"id":35271009,"url":"https://github.com/jsstevenson/oxley","last_synced_at":"2026-04-05T18:32:39.210Z","repository":{"id":43490800,"uuid":"480627303","full_name":"jsstevenson/oxley","owner":"jsstevenson","description":"Dynamically generate Pydantic classes from JSONschema","archived":false,"fork":false,"pushed_at":"2022-08-29T02:04:32.000Z","size":70,"stargazers_count":26,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-01T18:54:24.403Z","etag":null,"topics":["json-schema","pydantic","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/oxley/","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/jsstevenson.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":"2022-04-12T02:37:58.000Z","updated_at":"2025-04-24T17:23:40.000Z","dependencies_parsed_at":"2022-08-31T10:11:42.652Z","dependency_job_id":null,"html_url":"https://github.com/jsstevenson/oxley","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jsstevenson/oxley","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstevenson%2Foxley","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstevenson%2Foxley/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstevenson%2Foxley/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstevenson%2Foxley/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsstevenson","download_url":"https://codeload.github.com/jsstevenson/oxley/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstevenson%2Foxley/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31446524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T15:22:31.103Z","status":"ssl_error","status_checked_at":"2026-04-05T15:22:00.205Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["json-schema","pydantic","python"],"created_at":"2025-12-30T12:13:05.967Z","updated_at":"2026-04-05T18:32:39.204Z","avatar_url":"https://github.com/jsstevenson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    Oxley: Pydantic classes from JSON schema\n\u003c/h1\u003e\n\n**Oxley** generates [Pydantic](https://github.com/samuelcolvin/pydantic) classes at runtime from user-provided JSON schema documents. Heavily indebted to packages like [Python-JSONschema-Objects](https://github.com/cwacek/python-jsonschema-objects), Oxley enables data validation pipelines to function dynamically, and with the help of Pydantic, interface directly with popular web frameworks such as [FastAPI](https://github.com/tiangolo/fastapi) and [Starlite](https://github.com/starlite-api/starlite).\n\n## Quick start\n\nInstall from PIP:\n\n```shell\npython3 -m pip install oxley\n```\n\nGiven a simple JSONschema document:\n\n```json\n{\n  \"$id\": \"https://github.com/jsstevenson/oxley\",\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n  \"type\": \"object\",\n  \"$defs\": {\n    \"User\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"username\": {\"type\": \"string\"},\n        \"user_id\": {\"type\": \"number\"}\n      },\n      \"required\": [\"username\", \"user_id\"]\n    },\n    \"Post\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"author\": {\"$ref\": \"#/$defs/User\"},\n        \"content\": {\"type\": \"string\"},\n        \"allow_responses\": {\"type\": \"boolean\"}\n      },\n      \"required\": [\"author\", \"content\"]\n    }\n  }\n}\n```\n\nProvide a schema and construct classes:\n\n``` python\nfrom oxley import ClassBuilder\nschema_path = \"path/to/my_jsonschema_document.json\"\ncb = ClassBuilder(schema_path)\nUser, Post = cb.build_classes()\n```\n\nThe resulting objects are functioning Pydantic classes, providing features like runtime data validation and matching schema output.\n\n``` python\ndril = User(username=\"dril\", user_id=99)\npost = Post(author=dril, content=\"should i learn Letters first?  or choose the path of Numbers? a queston every baby must ask it self\")\nanother_post = Post(author=dril)  # raises pydantic.ValidationError\n```\n\n## Development\n\nClone and install dev and test dependencies:\n\n``` shell\ngit clone https://github.com/jsstevenson/oxley\ncd oxley\n# make virtual environment of your choosing\npython3 -m pip install \".[dev,test]\"\n```\n\nInstall pre-commit hooks:\n\n``` shell\npre-commit install\n```\n\nRun tests with tox:\n\n```\ntox\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsstevenson%2Foxley","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsstevenson%2Foxley","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsstevenson%2Foxley/lists"}