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

does not work with pydantic 2.5.2 #99

Closed
white-hat opened this issue Nov 30, 2023 · 3 comments
Closed

does not work with pydantic 2.5.2 #99

white-hat opened this issue Nov 30, 2023 · 3 comments

Comments

@white-hat
Copy link

white-hat commented Nov 30, 2023

When blockkit is used with the latest version of pydantic, I get errors like

AttributeError: 'StaticSelect' object has no attribute 'get'

This is caused by model validators not checking if passed argument is actually a dictionary

    @model_validator(mode="before")
    def _validate_values(cls, values: Dict) -> Dict:
        # I added these 2 lines to fix the issue, but I'm not sure if I'm breaking the validation process here
        if not isinstance(values, dict):
            return values
        initial_options = values.get("initial_options")
@white-hat
Copy link
Author

JFYI the code above is not a real fix, it disables validation as new versions of pydantic pass model classes to validator instead of dictionaries

@lookforward-github
Copy link
Contributor

Faced the same issue with TimePicker and MultiUsersSelect. Forced reinstallation of pydantic 2.3.0 helps.

pip install --force-reinstall -v "pydantic==2.3.0"

@imryche
Copy link
Owner

imryche commented Jan 2, 2024

Hey, thanks for highlighting the issue. I've fixed the Pydantic compatibility issues in the latest 1.6.2 release. Please go ahead and try it.

@imryche imryche closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants