Skip to content

Commit 08557c9

Browse files
authored
Merge pull request #23 from DanCardin/dc/bad-pydantic
fix: Bad field reference for pydantic inspection.
2 parents 3c2f4b6 + f9a1f55 commit 08557c9

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## 0.6
44

5+
### 0.6.1
6+
* fix: Bad field reference for pydantic inspection.
7+
58
### 0.6.0
69

710
* feat: Adopt type-lens library to better handle 3.12-style annotations which

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dataclass-settings"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
description = "Declarative dataclass settings."
55

66
urls = { repository = "https://github.com/dancardin/dataclass-settings" }
@@ -12,10 +12,7 @@ classifiers = ["Topic :: Software Development :: Libraries :: Python Modules"]
1212

1313
requires-python = ">=3.8,<4"
1414

15-
dependencies = [
16-
"typing-extensions >= 4.7.1",
17-
"type-lens >= 0.2.5",
18-
]
15+
dependencies = ["typing-extensions >= 4.7.1", "type-lens >= 0.2.5"]
1916

2017
[project.optional-dependencies]
2118
docstring = ["docstring-parser >= 0.15"]

src/dataclass_settings/class_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class PydanticV2Field(Field):
146146
def collect(cls, value: type, type_hints: dict[str, TypeView]) -> list[Self]:
147147
fields = []
148148
for name, f in value.model_fields.items(): # type: ignore
149-
type_view = type_hints[f.name]
149+
type_view = type_hints[name]
150150
field = cls.from_type_view(name, type_view)
151151

152152
if not detect(field.type_view.annotation):

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)