Skip to content

Commit

Permalink
try v2 default
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Nov 11, 2023
1 parent 70edf11 commit 343d906
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/xsdata_pydantic_basemodel/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def move_restrictions_to_pydantic_field(
elif self.pydantic_support == "auto":
use_v2 = PYDANTIC2
else: # v1 or both
use_v2 = False
use_v2 = True

restriction_map = V2_RESTRICTION_MAP if use_v2 else V1_RESTRICTION_MAP

Expand Down
11 changes: 1 addition & 10 deletions src/xsdata_pydantic_basemodel/pydantic_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@
from dataclasses import MISSING, field
from typing import TYPE_CHECKING, Any, Callable, Iterator, TypeVar

from pydantic_compat import PYDANTIC2

if TYPE_CHECKING:
# this needs fixing at pydantic_compat. which forwards the type import to Pydantic
# but in this case we need the metadata field:
# Unexpected keyword argument "metadata" for "Field" [call-arg]

from pydantic_compat._shared import Field
else:
from pydantic_compat import Field
from pydantic_compat import PYDANTIC2, Field

__all__ = ["Field", "PYDANTIC2"]

Expand Down

0 comments on commit 343d906

Please sign in to comment.