Skip to content

Commit 3c244da

Browse files
authored
docs: remove final pydantic v1 references (#3036)
1 parent 1cbfbc5 commit 3c244da

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/graphql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ from model import Book
145145
response = {...}
146146

147147
books = [
148-
Book.parse_obj(book_raw) for book_raw in response["getAuthorBooks"]
148+
Book.model_validate(book_raw) for book_raw in response["getAuthorBooks"]
149149
]
150150
print(books)
151151
# [Book(author=Author(books=[], id='51341cdscwef14r13', name='J. K. Rowling', typename__='Author'), id='1321dfvrt211wdw', title='Harry Potter and the Prisoner of Azkaban', typename__='Book'), Book(author=Author(books=[], id='51341cdscwef14r13', name='J. K. Rowling', typename__='Author'), id='dvsmu12e19xmqacqw9', title='Fantastic Beasts: The Crimes of Grindelwald', typename__='Book')]

docs/llms-full.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24658,7 +24658,7 @@ from model import Book
2465824658
response = {...}
2465924659

2466024660
books = [
24661-
Book.parse_obj(book_raw) for book_raw in response["getAuthorBooks"]
24661+
Book.model_validate(book_raw) for book_raw in response["getAuthorBooks"]
2466224662
]
2466324663
print(books)
2466424664
# [Book(author=Author(books=[], id='51341cdscwef14r13', name='J. K. Rowling', typename__='Author'), id='1321dfvrt211wdw', title='Harry Potter and the Prisoner of Azkaban', typename__='Book'), Book(author=Author(books=[], id='51341cdscwef14r13', name='J. K. Rowling', typename__='Author'), id='dvsmu12e19xmqacqw9', title='Fantastic Beasts: The Crimes of Grindelwald', typename__='Book')]

src/datamodel_code_generator/input_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _get_origin_name(origin: type) -> str:
130130

131131

132132
def _get_input_model_json_schema_class() -> type:
133-
"""Get the InputModelJsonSchema class (lazy import to avoid Pydantic v1 issues)."""
133+
"""Get the InputModelJsonSchema class lazily."""
134134
from pydantic.json_schema import GenerateJsonSchema # noqa: PLC0415
135135

136136
class InputModelJsonSchema(GenerateJsonSchema):

src/datamodel_code_generator/model/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def self_reference(self) -> bool:
204204
"""Check if field references its parent model.
205205
206206
Result is cached after first call since parent is stable at render time.
207-
Uses __dict__ for caching to avoid Pydantic v1 field assignment restrictions.
207+
Uses __dict__ for caching to avoid Pydantic-managed field assignment.
208208
"""
209209
if "_self_reference_cache" in self.__dict__:
210210
return self.__dict__["_self_reference_cache"]

0 commit comments

Comments
 (0)