Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 3125efc

Browse files
author
Phil Varner
authored
copy product with pydantic model_copy instead of copy.deepcopy (#109)
1 parent b3e4561 commit 3125efc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/stapi_fastapi/models/product.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from copy import deepcopy
43
from enum import Enum
54
from typing import TYPE_CHECKING, Literal, Optional, Self
65

@@ -78,7 +77,7 @@ def with_links(self: Self, links: list[Link] | None = None) -> Self:
7877
if not links:
7978
return self
8079

81-
new = deepcopy(self)
80+
new = self.model_copy(deep=True)
8281
new.links.extend(links)
8382
return new
8483

0 commit comments

Comments
 (0)