generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Pydantic V2 does not allow validating Literal of plain enum by enum values:
from githubkit.typing import Missing
from githubkit.compat import GitHubModel
from githubkit.utils import UNSET
class TestModel(GitHubModel):
a: Missing[bool] = UNSET
TestModel.model_validate(TestModel().model_dump(mode="json"))raises
ValidationError: 2 validation errors for TestModel
a.literal[<UNSET>]
Input should be <UNSET> [type=literal_error, input_value='<UNSET>', input_type=str]
For further information visit https://errors.pydantic.dev/2.8/v/literal_error
a.bool
Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='<UNSET>', input_type=str]
For further information visit https://errors.pydantic.dev/2.8/v/bool_parsing
Relevant pydantic issue: pydantic/pydantic#8708
Pydantic and python version:
pydantic version: 2.8.2
pydantic-core version: 2.20.1
pydantic-core build: profile=release pgo=truepackages/pydantic)
python version: 3.10.14 (main, Apr 15 2024, 18:40:16) [Clang 17.0.6 ]
platform: macOS-15.0.1-arm64-arm-64bit
related packages: typing_extensions-4.12.2 mypy-1.11.2 fastapi-0.109.1 pydantic-settings-2.0.3
commit: unknown
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested