Skip to content

Commit efacb2c

Browse files
authored
Merge pull request #14 from xnuinside/py_models_parser_pydantic_v2
Py models parser pydantic v2
2 parents 49b2e15 + cb6bdbf commit efacb2c

10 files changed

Lines changed: 585 additions & 624 deletions

File tree

.github/workflows/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Run flake8
2323
run: flake8 py_models_parser/ tests/
2424

25-
tox:
25+
tests:
2626
runs-on: ubuntu-latest
2727
needs: [flake8]
2828
strategy:
@@ -37,6 +37,9 @@ jobs:
3737
- name: Install dependencies
3838
run: |
3939
python -m pip install --upgrade pip
40-
pip install tox tox-gh-actions
41-
- name: Run tox
42-
run: tox -e py$(echo ${{ matrix.python-version }} | tr -d '.')
40+
pip install poetry
41+
poetry install
42+
env:
43+
POETRY_VIRTUALENVS_CREATE: false
44+
- name: Test with pytest
45+
run: pytest tests/ -vv

CHANGELOG.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-01-18
9+
10+
### Added
11+
12+
**Pydantic 2.x Support**
13+
- Union types with `|` operator (PEP 604): `int | None`, `str | None`
14+
- `Field()` with validation constraints: `max_length`, `min_length`, `gt`, `ge`, `lt`, `le`
15+
- `model_config` with `ConfigDict` handling
16+
- Nested generic types: `list[dict[str, str]]`, `dict[str, list[int]]`
17+
18+
**OpenAPI 3.0/Swagger Support**
19+
- New `parse_openapi()` function to parse OpenAPI specs from string
20+
- New `parse_openapi_file()` function to parse from YAML or JSON files
21+
- Supports OpenAPI 3.0 `components/schemas` and Swagger 2.0 `definitions`
22+
- Type mapping from OpenAPI types to Python types
23+
- Support for `$ref`, `allOf`, `oneOf`, `anyOf` compositions
24+
25+
**Python Version Support**
26+
- Added support for Python 3.12
27+
- Added support for Python 3.13
28+
29+
**Documentation**
30+
- Added ARCHITECTURE.md with project documentation
31+
32+
### Changed
33+
34+
**Breaking Changes**
35+
- Dropped support for Python 3.7
36+
- Dropped support for Python 3.8
37+
- Minimum required Python version is now 3.9
38+
39+
**Dependencies**
40+
- Added `pyyaml` dependency for OpenAPI parsing
41+
42+
### Testing
43+
- Added 8 new tests for Pydantic 2.x features
44+
- Added 15 tests for OpenAPI parsing
45+
- Updated CI to test Python 3.9, 3.10, 3.11, 3.12, 3.13
46+
47+
## [0.7.0]
48+
49+
### Changed
50+
- Updated to latest version of parsimonious
51+
- Library now works with Python 3.11
52+
53+
## [0.6.0]
54+
55+
### Added
56+
- Support for [Encode ORM](https://github.com/encode/orm) models
57+
- Support for [Piccolo ORM](https://piccolo-orm.readthedocs.io/en/latest/piccolo/schema/defining.html) models
58+
59+
## [0.5.1]
60+
61+
### Fixed
62+
- Multiple parent names in "parents" output were sometimes joined in one string
63+
64+
## [0.5.0]
65+
66+
### Added
67+
- Base support for PyDAL tables definitions
68+
- Support for Python list syntax like `[]`
69+
70+
## [0.4.0]
71+
72+
### Fixed
73+
- Return tuples (multiple values) are now parsed correctly
74+
- Symbols like `*&^%$#!±~`§<>` no longer cause errors
75+
- Classes without any args no longer cause errors
76+
77+
## [0.3.0]
78+
79+
### Added
80+
- CLI command `pmp` with `-d`, `--dump` arguments
81+
- Support for simple Django ORM models
82+
- Base support for pure Python classes
83+
84+
## [0.2.0]
85+
86+
### Added
87+
- Support for Dataclasses
88+
- `parse_from_file()` method
89+
- Correct handling of types with comma inside: `Union[dict, list]`, `Union[dict, list, tuple, anything]`
90+
91+
## [0.1.1]
92+
93+
### Added
94+
- Base parser logic for:
95+
- Pydantic models
96+
- Python Enums
97+
- SQLAlchemy Models
98+
- GinoORM models
99+
- TortoiseORM models
100+
- Initial test suite

CHANGELOG.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)