Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: koxudaxi/datamodel-code-generator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.26.5
Choose a base ref
...
head repository: koxudaxi/datamodel-code-generator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.27.0
Choose a head ref
  • 11 commits
  • 49 files changed
  • 7 contributors

Commits on Jan 30, 2025

  1. Migrate to use uv instead of poetry (#2288)

    * Migrate to use uv instead of poetry
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    * Support dependency groups in TOML on<3.11
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    * Check codespeed workaround
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    ---------
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    gaborbernat authored Jan 30, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    107168c View commit details

Commits on Feb 1, 2025

  1. Add tox configuration file (#2292)

    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    gaborbernat authored Feb 1, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4f45637 View commit details
  2. Fix collapse root model when list contains field with constraints #2067

    … (#2293)
    
    Co-authored-by: Dan Peachey <dan@netdevs.eu>
    Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
    3 people authored Feb 1, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    99a6939 View commit details
  3. Add cloudcoil (#2291)

    Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
    sambhav and koxudaxi authored Feb 1, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    96a023e View commit details

Commits on Feb 2, 2025

  1. bug: fix the tox fix environment failing (#2296)

    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    gaborbernat authored Feb 2, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2c7f319 View commit details

Commits on Feb 3, 2025

  1. Migrate mypy to pyright (#2295)

    * feat: fix types
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    * feat: remove mypy from deps
    
    * feat: run lint and other checks in CI
    
    * fix: fix setup env
    
    * fix: remove unnecessary lines in CI config
    
    * fix: remove unnecessary lines in CI config
    
    * fix: fix CI uv
    
    * fix: fix CI uv
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: fix types
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: fix types
    
    * fix: ignore local coverage check in CI
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    * fix: exclude readme for windows
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    koxudaxi and pre-commit-ci[bot] authored Feb 3, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    95b28c3 View commit details
  2. fix: update type-checker config (#2298)

    koxudaxi authored Feb 3, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    48abf0e View commit details

Commits on Feb 4, 2025

  1. fix: Parser crashes when input contains duplicate schemas at root lev…

    …el (#2301)
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    gaborbernat authored Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8158143 View commit details
  2. fix: merge test coverage before upload (#2299)

    koxudaxi authored Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7f46b3e View commit details

Commits on Feb 5, 2025

  1. setup-trusted-publisher (#2303)

    * setup-trusted-publisher
    
    * Update publish.yml
    
    * Update publish.yml
    
    * Update publish.yml
    koxudaxi authored Feb 5, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0204b72 View commit details

Commits on Feb 6, 2025

  1. Fix custom package install in CI is not working (#2302)

    * Fix custom package install in CI is overriden
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    * Instal toml for custom isort
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    * Ignore black doesn't support experimental string processing
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    * Add custom test environments to tox
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    
    ---------
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    gaborbernat authored Feb 6, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dd32694 View commit details
Showing with 5,248 additions and 2,738 deletions.
  1. +5 −0 .github/workflows/codeql.yml
  2. +4 −0 .github/workflows/codespell.yml
  3. +11 −19 .github/workflows/codspeed.yml
  4. +10 −16 .github/workflows/docs.yml
  5. +36 −24 .github/workflows/publish.yml
  6. +116 −127 .github/workflows/test.yml
  7. +2 −177 .gitignore
  8. +16 −6 .pre-commit-config.yaml
  9. +2 −0 README.md
  10. +11 −3 datamodel_code_generator/__init__.py
  11. +12 −10 datamodel_code_generator/__main__.py
  12. +2 −1 datamodel_code_generator/http.py
  13. +1 −1 datamodel_code_generator/imports.py
  14. +3 −1 datamodel_code_generator/model/__init__.py
  15. +7 −5 datamodel_code_generator/model/base.py
  16. +1 −1 datamodel_code_generator/model/enum.py
  17. +1 −1 datamodel_code_generator/model/pydantic/base_model.py
  18. +1 −1 datamodel_code_generator/model/pydantic/types.py
  19. +2 −2 datamodel_code_generator/model/pydantic_v2/base_model.py
  20. +4 −1 datamodel_code_generator/model/pydantic_v2/types.py
  21. +17 −7 datamodel_code_generator/parser/base.py
  22. +4 −4 datamodel_code_generator/parser/graphql.py
  23. +5 −4 datamodel_code_generator/parser/jsonschema.py
  24. +7 −5 datamodel_code_generator/parser/openapi.py
  25. +1 −1 datamodel_code_generator/pydantic_patch.py
  26. +5 −5 datamodel_code_generator/reference.py
  27. +14 −12 datamodel_code_generator/types.py
  28. +7 −11 datamodel_code_generator/util.py
  29. +14 −12 docs/development-contributing.md
  30. +0 −2,064 poetry.lock
  31. +173 −145 pyproject.toml
  32. +0 −2 requirements-docs.txt
  33. +0 −9 scripts/format.sh
  34. +0 −8 scripts/lint.sh
  35. +0 −1 scripts/test.bat
  36. +0 −5 scripts/test.sh
  37. +5 −5 scripts/update_command_help_on_markdown.py
  38. +10 −3 tests/data/expected/main/jsonschema/array_field_constraints.py
  39. +11 −3 tests/data/expected/main/openapi/collapse_root_models_field_constraints.py
  40. +13 −0 tests/data/expected/parser/openapi/openapi_parser_parse_duplicate_models_simplify/output.py
  41. +17 −0 tests/data/openapi/duplicate_model_simplify.yaml
  42. +2 −3 tests/data/pyproject.toml
  43. +23 −8 tests/main/openapi/test_main_openapi.py
  44. +2 −1 tests/parser/test_jsonschema.py
  45. +87 −18 tests/parser/test_openapi.py
  46. +17 −4 tests/test_format.py
  47. +8 −2 tests/test_main_kr.py
  48. +128 −0 tox.ini
  49. +4,431 −0 uv.lock
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -7,6 +7,11 @@ on:
branches: [ "main" ]
schedule:
- cron: "26 1 * * 4"
workflow_dispatch:

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
4 changes: 4 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: codespell-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

30 changes: 11 additions & 19 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -9,34 +9,26 @@ on:
# performance analysis in order to generate initial data.
workflow_dispatch:

concurrency:
group: codespeed-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmarks:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# uv standalone build is not compatible with CodSpeedHQ
# https://github.com/astral-sh/uv/issues/11006
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-path: .venv
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-codspeed-3.12-v1-${{ hashFiles('**/poetry.lock') }}
python-version: "3.13"
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction

run: uv sync
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: poetry run pytest tests/ --codspeed -n auto
run: .venv/bin/pytest tests/ --codspeed -n auto
26 changes: 10 additions & 16 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -4,29 +4,23 @@ on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
build-deploy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: 'x64'

- uses: actions/cache@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install mkdocs
run: |
pip install -r requirements-docs.txt
python-version: 3.13
- name: Install dependencies
run: uv sync
- name: build site
run: mkdocs build --verbose --clean --strict
- name: Deploy
60 changes: 36 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -5,40 +5,52 @@ on:
tags:
- '**'

env:
dists-artifact-name: python-package-distributions

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-24.04
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.8
uses: actions/setup-python@v4
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Build package
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
python-version: 3.8
- name: Build publish
run: |
python -m pip install poetry poetry-dynamic-versioning
poetry install
poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
name: ${{ env.dists-artifact-name }}
path: dist/*

release:
name: Publish package to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/datamodel-code-generator/${{ github.ref_name }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: ${{ env.dists-artifact-name }}
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
user: __token__
password: ${{ secrets.pypi_password }}
attestations: true

push_to_registry:
name: Push Docker image to Docker Hub
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-24.04
needs: build-n-publish
needs: release
steps:
- name: Check out the repo
uses: actions/checkout@v2
Loading