Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when run using Python version 3.12.3 #27

Open
hughandersen opened this issue Sep 23, 2024 · 2 comments
Open

TypeError when run using Python version 3.12.3 #27

hughandersen opened this issue Sep 23, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hughandersen
Copy link

I get an error when running this line of code when using Python version 3.12.3.

from optionlab import VERSION, run_strategy

TypeError: 'list' is not a valid discriminated union variant; should be a BaseModel or dataclass

@rgaveiga
Copy link
Owner

It seems this problem has to do with Pydantic version >= 2.9: koxudaxi/datamodel-code-generator#1937
It works with Pydantic 2.8.2.

@rgaveiga
Copy link
Owner

Line 206 in models.py:
strategy: list[Strategy] = Field(..., min_length=1, discriminator="type")
This is the line that generates the error above for Pydantic >= 2.9.

@rgaveiga rgaveiga self-assigned this Sep 24, 2024
@rgaveiga rgaveiga added the bug Something isn't working label Sep 24, 2024
@rgaveiga rgaveiga mentioned this issue Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants