{"id":13494250,"url":"https://github.com/bogdandm/json2python-models","last_synced_at":"2026-01-18T00:37:15.412Z","repository":{"id":33537634,"uuid":"144019032","full_name":"bogdandm/json2python-models","owner":"bogdandm","description":"Generate Python model classes (pydantic, attrs, dataclasses) based on JSON datasets with typing module support","archived":false,"fork":false,"pushed_at":"2025-03-12T08:18:42.000Z","size":932,"stargazers_count":179,"open_issues_count":4,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T00:24:02.281Z","etag":null,"topics":["attrs","dataclasses","datasets","generator","json","models","pydantic","python","sqlmodel","typing"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/json2python-models/","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/bogdandm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-08T13:40:00.000Z","updated_at":"2025-10-13T16:26:17.000Z","dependencies_parsed_at":"2025-03-28T13:38:59.501Z","dependency_job_id":"ce3892bf-1cc1-4501-964b-b09c2255590b","html_url":"https://github.com/bogdandm/json2python-models","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/bogdandm/json2python-models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdandm%2Fjson2python-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdandm%2Fjson2python-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdandm%2Fjson2python-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdandm%2Fjson2python-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bogdandm","download_url":"https://codeload.github.com/bogdandm/json2python-models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bogdandm%2Fjson2python-models/sbom","scorecard":{"id":246875,"data":{"date":"2025-08-11","repo":{"name":"github.com/bogdandm/json2python-models","commit":"da2733ce5bd1307e66ca212a665d5a41365ff97b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test_and_release.yml:1","Warn: no topLevel permission defined: .github/workflows/test_every_week.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/bogdandm/json2python-models/test_and_release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_release.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/bogdandm/json2python-models/test_and_release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_release.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/bogdandm/json2python-models/test_and_release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test_and_release.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/bogdandm/json2python-models/test_and_release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_every_week.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bogdandm/json2python-models/test_every_week.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/test_and_release.yml:44","Warn: pipCommand not pinned by hash: .github/workflows/test_and_release.yml:45","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.3.1 not signed: https://api.github.com/repos/bogdandm/json2python-models/releases/181703595","Warn: release artifact v0.3.0 not signed: https://api.github.com/repos/bogdandm/json2python-models/releases/87693041","Warn: release artifact v0.2.7 not signed: https://api.github.com/repos/bogdandm/json2python-models/releases/76609329","Warn: release artifact v0.2.6 not signed: https://api.github.com/repos/bogdandm/json2python-models/releases/76130167","Warn: release artifact v0.2.5 not signed: https://api.github.com/repos/bogdandm/json2python-models/releases/61475362","Warn: release artifact v0.3.1 does not have provenance: https://api.github.com/repos/bogdandm/json2python-models/releases/181703595","Warn: release artifact v0.3.0 does not have provenance: https://api.github.com/repos/bogdandm/json2python-models/releases/87693041","Warn: release artifact v0.2.7 does not have provenance: https://api.github.com/repos/bogdandm/json2python-models/releases/76609329","Warn: release artifact v0.2.6 does not have provenance: https://api.github.com/repos/bogdandm/json2python-models/releases/76130167","Warn: release artifact v0.2.5 does not have provenance: https://api.github.com/repos/bogdandm/json2python-models/releases/61475362"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2019-217 / GHSA-462w-v97r-4m45","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: PYSEC-2021-66 / GHSA-g3rq-g295-4j3m","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T07:45:58.215Z","repository_id":33537634,"created_at":"2025-08-17T07:45:58.215Z","updated_at":"2025-08-17T07:45:58.215Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: 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":["attrs","dataclasses","datasets","generator","json","models","pydantic","python","sqlmodel","typing"],"created_at":"2024-07-31T19:01:23.200Z","updated_at":"2026-01-16T12:03:52.788Z","avatar_url":"https://github.com/bogdandm.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![json2python-models](/etc/logo.png)](https://github.com/bogdandm/json2python-models)\n\n[![PyPI version](https://img.shields.io/pypi/v/json2python-models.svg?color=green)](https://badge.fury.io/py/json2python-models)\n[![Build](https://github.com/bogdandm/json2python-models/actions/workflows/test_and_release.yml/badge.svg)](https://github.com/bogdandm/json2python-models/actions/workflows/test_and_release.yml)\n[![Coverage Status](https://coveralls.io/repos/github/bogdandm/json2python-models/badge.svg?branch=master)](https://coveralls.io/github/bogdandm/json2python-models?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/11e13f2b81d7450eb0bca4b941d16d81)](https://www.codacy.com/app/bogdandm/json2python-models?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=bogdandm/json2python-models\u0026amp;utm_campaign=Badge_Grade)\n\n![Example](/etc/convert.png)\n\njson2python-models is a [Python](https://www.python.org/) tool that can generate Python models classes\n([pydantic](https://docs.pydantic.dev/), ([sqlmodel](https://sqlmodel.tiangolo.com/),\ndataclasses, [attrs](https://www.attrs.org/en/stable/))\nfrom JSON datasets.\n\n## Features\n\n* Full **`typing` module** support\n* **Types merging** - if some field contains data of different types this will be represented as `Union` type\n* Fields and models **names** generation (unicode support included)\n* Similar **models generalization**\n* Handling **recursive data** structures (i.e. family tree)\n* Detecting **string serializable types** (i.e. datetime or just stringify numbers)\n* Detecting fields containing string constants (`Literal['foo', 'bar']`)\n* Generation models as **list** (flat models structure) or **tree** (nested models)\n* Specifying when dictionaries should be processed as **`dict` type** (by default every dict is considered as some model)\n* **CLI** API with a lot of options\n\n## Table of Contents\n\n* [Features](#features)\n* [Table of Contents](#table-of-contents)\n* [Example](#example)\n* [Installation](#installation)\n* [Usage](#usage)\n    * [CLI](#cli)\n    * [Low level API]()\n* [Tests](#tests)\n    * [Test examples](#test-examples)\n* [Built With](#built-with)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Examples\n\n### Part of Path of Exile public items API\n\n```python\nfrom pydantic import BaseModel, Field\nfrom typing import List, Optional\nfrom typing_extensions import Literal\n\n\nclass Tab(BaseModel):\n    id_: str = Field(..., alias=\"id\")\n    public: bool\n    stash_type: Literal[\"CurrencyStash\", \"NormalStash\", \"PremiumStash\"] = Field(..., alias=\"stashType\")\n    items: List['Item']\n    account_name: Optional[str] = Field(None, alias=\"accountName\")\n    last_character_name: Optional[str] = Field(None, alias=\"lastCharacterName\")\n    stash: Optional[str] = None\n    league: Optional[Literal[\"Hardcore\", \"Standard\"]] = None\n```\n\n### F1 Season Results\n\n\u003cdetails\u003e\u003csummary\u003e----- Show -----\u003c/summary\u003e\n\u003cp\u003e\n\n```\ndriver_standings.json\n[\n    {\n        \"season\": \"2019\",\n        \"round\": \"3\",\n        \"DriverStandings\": [\n            {\n                \"position\": \"1\",\n                \"positionText\": \"1\",\n                \"points\": \"68\",\n                \"wins\": \"2\",\n                \"Driver\": {\n                    \"driverId\": \"hamilton\",\n                    \"permanentNumber\": \"44\",\n                    \"code\": \"HAM\",\n                    \"url\": \"http://en.wikipedia.org/wiki/Lewis_Hamilton\",\n                    \"givenName\": \"Lewis\",\n                    \"familyName\": \"Hamilton\",\n                    \"dateOfBirth\": \"1985-01-07\",\n                    \"nationality\": \"British\"\n                },\n                \"Constructors\": [\n                    {\n                        \"constructorId\": \"mercedes\",\n                        \"url\": \"http://en.wikipedia.org/wiki/Mercedes-Benz_in_Formula_One\",\n                        \"name\": \"Mercedes\",\n                        \"nationality\": \"German\"\n                    }\n                ]\n            },\n            ...\n        ]\n    }\n]\n```\n\n```\njson2models -f pydantic -m DriverStandings driver_standings.json\n```\n\n```python\nr\"\"\"\ngenerated by json2python-models v0.2.0 at Mon May  4 17:46:30 2020\ncommand: /opt/projects/json2python-models/venv/bin/json2models -f pydantic -s flat -m DriverStandings driver_standings.json\n\"\"\"\nfrom pydantic import BaseModel, Field\nfrom typing import List\nfrom typing_extensions import Literal\n\nclass DriverStandings(BaseModel):\n    season: int\n    round_: int = Field(..., alias=\"round\")\n    DriverStandings: List['DriverStanding']\n\nclass DriverStanding(BaseModel):\n    position: int\n    position_text: int = Field(..., alias=\"positionText\")\n    points: int\n    wins: int\n    driver: 'Driver' = Field(..., alias=\"Driver\")\n    constructors: List['Constructor'] = Field(..., alias=\"Constructors\")\n\nclass Driver(BaseModel):\n    driver_id: str = Field(..., alias=\"driverId\")\n    permanent_number: int = Field(..., alias=\"permanentNumber\")\n    code: str\n    url: str\n    given_name: str = Field(..., alias=\"givenName\")\n    family_name: str = Field(..., alias=\"familyName\")\n    date_of_birth: str = Field(..., alias=\"dateOfBirth\")\n    nationality: str\n\nclass Constructor(BaseModel):\n    constructor_id: str = Field(..., alias=\"constructorId\")\n    url: str\n    name: str\n    nationality: Literal[\"Austrian\", \"German\", \"American\", \"British\", \"Italian\", \"French\"]\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Swagger\n\n\u003cdetails\u003e\u003csummary\u003e----- Show -----\u003c/summary\u003e\n\u003cp\u003e\n\n`swagger.json` from any online API (I tested file generated by drf-yasg and another one for Spotify API)\n\nIt requires a bit of tweaking:\n* Some fields store routes/models specs as dicts\n* There are a lot of optional fields, so we reduce merging threshold\n* Disable string literals\n\n```\njson2models -f dataclasses -m Swagger testing_tools/swagger.json \\\n    --dict-keys-fields securityDefinitions paths responses definitions properties \\\n    --merge percent_50 number --max-strings-literals 0\n```\n\n```python\nr\"\"\"\ngenerated by json2python-models v0.2.0 at Mon May  4 18:08:09 2020\ncommand: /opt/projects/json2python-models/json_to_models/__main__.py -s flat -f dataclasses -m Swagger testing_tools/swagger.json --max-strings-literals 0 --dict-keys-fields securityDefinitions paths responses definitions properties --merge percent_50 number\n\"\"\"\nfrom dataclasses import dataclass, field\nfrom json_to_models.dynamic_typing import FloatString\nfrom typing import Any, Dict, List, Optional, Union\n\n\n@dataclass\nclass Swagger:\n    swagger: FloatString\n    info: 'Info'\n    host: str\n    schemes: List[str]\n    base_path: str\n    consumes: List[str]\n    produces: List[str]\n    security_definitions: Dict[str, 'Parameter_SecurityDefinition']\n    security: List['Security']\n    paths: Dict[str, 'Path']\n    definitions: Dict[str, 'Definition_Schema']\n\n\n@dataclass\nclass Info:\n    title: str\n    description: str\n    version: str\n\n\n@dataclass\nclass Security:\n    api_key: Optional[List[Any]] = field(default_factory=list)\n    basic: Optional[List[Any]] = field(default_factory=list)\n\n\n@dataclass\nclass Path:\n    parameters: List['Parameter_SecurityDefinition']\n    post: Optional['Delete_Get_Patch_Post_Put'] = None\n    get: Optional['Delete_Get_Patch_Post_Put'] = None\n    put: Optional['Delete_Get_Patch_Post_Put'] = None\n    patch: Optional['Delete_Get_Patch_Post_Put'] = None\n    delete: Optional['Delete_Get_Patch_Post_Put'] = None\n\n\n@dataclass\nclass Property:\n    type_: str\n    format_: Optional[str] = None\n    xnullable: Optional[bool] = None\n    items: Optional['Item_Schema'] = None\n\n\n@dataclass\nclass Property_2E:\n    type_: str\n    title: Optional[str] = None\n    read_only: Optional[bool] = None\n    max_length: Optional[int] = None\n    min_length: Optional[int] = None\n    items: Optional['Item'] = None\n    enum: Optional[List[str]] = field(default_factory=list)\n    maximum: Optional[int] = None\n    minimum: Optional[int] = None\n    format_: Optional[str] = None\n\n\n@dataclass\nclass Item:\n    title: Optional[str] = None\n    type_: Optional[str] = None\n    ref: Optional[str] = None\n    max_length: Optional[int] = None\n    min_length: Optional[int] = None\n\n\n@dataclass\nclass Parameter_SecurityDefinition:\n    name: Optional[str] = None\n    in_: Optional[str] = None\n    required: Optional[bool] = None\n    schema: Optional['Item_Schema'] = None\n    description: Optional[str] = None\n    type_: Optional[str] = None\n\n\n@dataclass\nclass Delete_Get_Patch_Post_Put:\n    operation_id: str\n    description: str\n    parameters: List['Parameter_SecurityDefinition']\n    responses: Dict[str, 'Response']\n    tags: List[str]\n\n\n@dataclass\nclass Item_Schema:\n    ref: str\n\n\n@dataclass\nclass Response:\n    description: str\n    schema: Optional[Union['Item_Schema', 'Definition_Schema']] = None\n\n\n@dataclass\nclass Definition_Schema:\n    type_: str\n    required: Optional[List[str]] = field(default_factory=list)\n    properties: Optional[Dict[str, Union['Property', 'Property_2E']]] = field(default_factory=dict)\n    ref: Optional[str] = None\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Github-actions config files\n\n\u003cdetails\u003e\u003csummary\u003e----- Show -----\u003c/summary\u003e\n\u003cp\u003e\n\nGithub-actions model based on files from [starter-workflows](https://github.com/actions/starter-workflows/tree/main/ci)\n\n```\njson2models -m Actions \"./starter-workflows/ci/*.yml\" -s flat -f pydantic -i yaml --dkf env with jobs\n```\n\n```python\nr\"\"\"\ngenerated by json2python-models v0.2.3 at Tue Jul 13 19:52:43 2021\ncommand: /opt/projects/json2python-models/venv/bin/json2models -m Actions ./starter-workflows/ci/*.yml -s flat -f pydantic -i yaml --dkf env with jobs\n\"\"\"\nfrom pydantic import BaseModel, Field\nfrom typing import Dict, List, Optional, Union\nfrom typing_extensions import Literal\n\n\nclass Actions(BaseModel):\n    on: Union['On', List[Literal[\"push\"]]]\n    jobs: Dict[str, 'Job']\n    name: Optional[str] = None\n    env: Optional[Dict[str, Union[int, str]]] = {}\n\n\nclass On(BaseModel):\n    push: Optional['Push'] = None\n    pull_request: Optional['PullRequest'] = None\n    release: Optional['Release'] = None\n    schedule: Optional[List['Schedule']] = []\n    workflow_dispatch: Optional[None] = None\n\n\nclass Push(BaseModel):\n    branches: List[Literal[\"$default-branch\"]]\n    tags: Optional[List[Literal[\"v*.*.*\"]]] = []\n\n\nclass PullRequest(BaseModel):\n    branches: List[Literal[\"$default-branch\"]]\n\n\nclass Release(BaseModel):\n    types: List[Literal[\"created\", \"published\"]]\n\n\nclass Schedule(BaseModel):\n    cron: Literal[\"$cron-daily\"]\n\n\nclass Job(BaseModel):\n    runson: Literal[\"${{ matrix.os }}\", \"macOS-latest\", \"macos-latest\", \"ubuntu-18.04\", \"ubuntu-latest\", \"windows-latest\"] = Field(..., alias=\"runs-on\")\n    steps: List['Step']\n    name: Optional[str] = None\n    environment: Optional[Literal[\"production\"]] = None\n    outputs: Optional['Output'] = None\n    container: Optional['Container'] = None\n    needs: Optional[Literal[\"build\"]] = None\n    permissions: Optional['Permission'] = None\n    strategy: Optional['Strategy'] = None\n    defaults: Optional['Default'] = None\n    env: Optional[Dict[str, str]] = {}\n\n\nclass Step(BaseModel):\n    uses: Optional[str] = None\n    name: Optional[str] = None\n    with_: Optional[Dict[str, Union[bool, float, str]]] = Field({}, alias=\"with\")\n    run: Optional[str] = None\n    env: Optional[Dict[str, str]] = {}\n    workingdirectory: Optional[str] = Field(None, alias=\"working-directory\")\n    id_: Optional[Literal[\"build-image\", \"composer-cache\", \"deploy-and-expose\", \"image-build\", \"login-ecr\", \"meta\", \"push-to-registry\", \"task-def\"]] = Field(None, alias=\"id\")\n    if_: Optional[str] = Field(None, alias=\"if\")\n    shell: Optional[Literal[\"Rscript {0}\"]] = None\n\n\nclass Output(BaseModel):\n    route: str = Field(..., alias=\"ROUTE\")\n    selector: str = Field(..., alias=\"SELECTOR\")\n\n\nclass Container(BaseModel):\n    image: Literal[\"crystallang/crystal\", \"erlang:22.0.7\"]\n\n\nclass Permission(BaseModel):\n    contents: Literal[\"read\"]\n    packages: Literal[\"write\"]\n\n\nclass Strategy(BaseModel):\n    matrix: Optional['Matrix'] = None\n    maxparallel: Optional[int] = Field(None, alias=\"max-parallel\")\n    failfast: Optional[bool] = Field(None, alias=\"fail-fast\")\n\n\nclass Matrix(BaseModel):\n    rversion: Optional[List[float]] = Field([], alias=\"r-version\")\n    pythonversion: Optional[List[float]] = Field([], alias=\"python-version\")\n    deno: Optional[List[Literal[\"canary\", \"v1.x\"]]] = []\n    os: Optional[List[Literal[\"macOS-latest\", \"ubuntu-latest\", \"windows-latest\"]]] = []\n    rubyversion: Optional[List[float]] = Field([], alias=\"ruby-version\")\n    nodeversion: Optional[List[Literal[\"12.x\", \"14.x\", \"16.x\"]]] = Field([], alias=\"node-version\")\n    configuration: Optional[List[Literal[\"Debug\", \"Release\"]]] = []\n\n\nclass Default(BaseModel):\n    run: 'Run'\n\n\nclass Run(BaseModel):\n    shell: Literal[\"bash\"]\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n### Example with preamble\n\n\u003cdetails\u003e\u003csummary\u003e----- Show -----\u003c/summary\u003e\n\u003cp\u003e\nA simple example to demonstrate adding extra code before the class list.\n\n```sh\njson2models -f pydantic --preamble \"# set up defaults\nUSERNAME = 'user'\nSERVER_IP = '127.0.0.1'\n\" -m Swagger testing_tools/swagger.json\n```\n\n```py\nr\"\"\"\ngenerated by json2python-models v0.2.5 at Tue Aug 23 08:55:09 2022\ncommand: json2models -f pydantic --preamble # set up defaults\nUSERNAME = 'user'\nSERVER_IP = '127.0.0.1'\n -m Swagger testing_tools/swagger.json -o output.py\n\"\"\"\nfrom pydantic import BaseModel, Field\nfrom typing import Any, List, Literal, Optional, Union\n\n\n# set up defaults\nUSERNAME = 'user'\nSERVER_IP = '127.0.0.1'\n\n\n\nclass Swagger(BaseModel):\n    # etc.\n```\n\u003c/p\u003e\u003c/details\u003e\n\n## Installation\n\nTo install it, use `pip`:\n\n`pip install json2python-models`\n\nOr you can build it from source:\n\n```\ngit clone https://github.com/bogdandm/json2python-models.git\ncd json2python-models\npython setup.py install\n```\n\n## Usage\n\n### CLI\n\nFor regular usage CLI tool is the best option. After you install this package you can use it as `json2models \u003carguments\u003e`\nor `python -m json_to_models \u003carguments\u003e`. I.e.:\n```\njson2models -m Car car_*.json -f attrs \u003e car.py\n```\n\nArguments:\n\n* `-h`, `--help` - Show help message and exit\n\n* `-m`, `--model` - Model name and its JSON data as path or unix-like path pattern.\n  `*`,  `**` or `?` patterns symbols are supported.\n  JSON data could be an array of models or single model.\n  If this file contains dict with nested list than you can pass\n  `\u003cJSON lookup\u003e`. Deep lookups are supported by dot-separated path.\n  If no lookup needed pass '-' as `\u003cJSON lookup\u003e` (default)\n  * **Format**: `-m \u003cModel name\u003e [\u003cJSON lookup\u003e] \u003cFile path or pattern\u003e`\n  * **Example**: `-m Car audi.json -m Car results reno.json`\n\n* `-i`, `--input-format` - Input file format (parser). Default is JSON parser. Yaml parser requires PyYaml or\n  ruamel.yaml to be installed. Ini parser uses\n  builtin [configparser](https://docs.python.org/3/library/configparser.html). To implement new one - add new method\n  to `cli.FileLoaders` (and create pull request :) )\n  * **Format**: `-i {json, yaml, ini}`\n  * **Example**: `-i yaml`\n  * **Default**: `-i json`\n\n* `-o`, `--output` - Output file\n    * **Format**: `-o \u003cFILE\u003e`\n    * **Example**: `-o car_model.py`\n\n* `-f`, `--framework` - Model framework for which python code is generated.\n  `base` (default) mean no framework so code will be generated without any decorators and additional meta-data.\n    * **Format**: `-f {base, pydantic, sqlmodel, attrs, dataclasses, custom}`\n    * **Example**: `-f pydantic`\n    * **Default**: `-f base`\n    * **Warning**: SQLModel generator does not support Relationships and Foreign keys, they have to be added manually\n\n* `-s`, `--structure` - Models composition style.\n    * **Format**: `-s {flat, nested}`\n    * **Example**: `-s nested`\n    * **Default**: `-s flat`\n\n* `--preamble` - Additional material to be\n    * **Format**: `--preamble \"\u003cformatted python code string to be added after module imports\u003e\"`\n    * **Example**:\n  ```sh\n  --preamble \"# set up defaults\n  USERNAME = 'user'\n  SERVER = '127.0.0.1'\"\n  ```\n    * **Optional**\n\n* `--datetime` - Enable datetime/date/time strings parsing.\n    * **Default**: disabled\n    * **Warning**: This can lead to 6-7 times slowdown on large datasets. Be sure that you really need this option.\n\n* `--disable-unicode-conversion`, `--no-unidecode` - Disable unicode conversion in field labels and class names\n    * **Default**: enabled\n\n* `--strings-converters` - Enable generation of string types converters (i.e. `IsoDatetimeString` or `BooleanString`).\n    * **Default**: disabled\n\n* `--max-strings-literals` -  Generate `Literal['foo', 'bar']` when field have less than NUMBER string constants as values.\n    * **Format**: `--max-strings-literals \u003cNUMBER\u003e`\n    * **Default**: 10 (generator classes could override it)\n    * **Example**: `--max-strings-literals 5` - only 5 literals will be saved and used to code generation\n    * **Note**: There could not be more than **15** literals per field (for performance reasons)\n    * **Note**: `attrs` code generator do not use Literals and just generate `str` fields instead\n\n* `--merge` - Merge policy settings. Possible values are:\n    * **Format**: `--merge MERGE_POLICY [MERGE_POLICY ...]`\n    * **Possible values** (MERGE_POLICY):\n        * `percent[_\u003cpercent\u003e]` - two models had a certain percentage of matched field names.\n            Custom value could be i.e. `percent_95`.\n        * `number[_\u003cnumber\u003e]` - two models had a certain number of matched field names.\n        * `exact` - two models should have exact same field names to merge.\n    * **Example**: `--merge percent_95 number_20` - merge if 95% of fields are matched or 20 of fields are matched\n    * **Default**: `--merge percent_70 number_10`\n\n* `--dict-keys-regex`, `--dkr` - List of regular expressions (Python syntax).\n    If all keys of some dict are match one of the pattern then\n    this dict will be marked as dict field but not nested model.\n    * **Format**: `--dkr RegEx [RegEx ...]`\n    * **Example**: `--dkr node_\\d+ \\d+_\\d+_\\d+`\n    * **Note**: `^` and `$` (string borders) tokens will be added automatically, but you\n        have to escape other special characters manually.\n    * **Optional**\n\n* `--dict-keys-fields`, `--dkf` - List of model fields names that will be marked as dict fields\n    * **Format**: `--dkf FIELD_NAME [FIELD_NAME ...]`\n    * **Example**: `--dkf \"dict_data\" \"mapping\"`\n    * **Optional**\n\n* `--code-generator` - Absolute import path to `GenericModelCodeGenerator` subclass.\n    * **Format**: `--code-generator CODE_GENERATOR`\n    * **Example**: `-f mypackage.mymodule.DjangoModelsGenerator`\n    * **Note**: Is ignored without `-f custom` but is required with it.\n\n* `--code-generator-kwargs` - List of GenericModelCodeGenerator subclass arguments (for `__init__` method,\n    see docs of specific subclass).\n    Each argument should be in following format: `argument_name=value` or `\"argument_name=value with space\"`.\n    Boolean values should be passed in JS style: `true` or `false`\n    * **Format**: `--code-generator-kwargs [NAME=VALUE [NAME=VALUE ...]]`\n    * **Example**:  `--code-generator-kwargs kwarg1=true kwarg2=10 \"kwarg3=It is string with spaces\"`\n    * **Optional**\n\n* `--disable-str-serializable-types` - List of python types for which StringSerializable should be disabled.\n    Alternatively you could use the name of StringSerializable subclass itself (i.e. IntString).\n    * **Format**: `--disable-str-serializable-types [TYPE [TYPE ...]]`\n    * **Example**:  `--disable-str-serializable-types float int BooleanString IsoDatetimeString`\n    * **Optional**\n\n### Low level API\n\n\\-\n\n## Tests\n\nTo run tests you should clone project and run `setup.py` script:\n\n```\ngit clone https://github.com/bogdandm/json2python-models.git\ncd json2python-models\npython setup.py test -a '\u003cpytest additional arguments\u003e'\n```\n\nAlso, I would recommend you to install `pytest-sugar` for pretty printing test results\n\n### Test examples\n\nYou can find out some examples of usage of this project at [testing_tools/real_apis/...](/testing_tools/real_apis)\n\nEach file contains functions to download data from some online API (references included at the top of file) and\n`main` function that generates and prints code. Some examples may print debug data before actual code.\nDownloaded data will be saved at `testing_tools/real_apis/\u003cname of example\u003e/\u003cdataset\u003e.json`\n\n## Built With\n\n* [python-dateutil](https://github.com/dateutil/dateutil) - Datetime parsing\n* [inflection](https://github.com/jpvanhal/inflection) - String transformations\n* [Unidecode](https://pypi.org/project/Unidecode/) - Unicode to ASCII conversion\n* [Jinja2](https://github.com/pallets/jinja) - Code templates\n* [ordered-set](https://github.com/LuminosoInsight/ordered-set) is used in models merging algorithm\n\nTest tools:\n* [pytest](https://github.com/pytest-dev/pytest) - Test framework\n* [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) - Parallel execution of test suites\n* [pytest-sugar](https://github.com/Frozenball/pytest-sugar) - Test results pretty printing\n* [requests](https://github.com/kennethreitz/requests) - Test data download\n\n## Contributing\n\nFeel free to open pull requests with new features or bug fixes. Just follow few rules:\n\n1. Always use some code formatter ([black](https://github.com/ambv/black) or PyCharm built-in)\n2. Keep code coverage above 95-98%\n3. All existing tests should be passed (including test examples from `testing_tools/real_apis`)\n4. Use `typing` module\n5. Fix [codacy](https://app.codacy.com/project/bogdandm/json2python-models/dashboard) issues from your PR\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbogdandm%2Fjson2python-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbogdandm%2Fjson2python-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbogdandm%2Fjson2python-models/lists"}