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

ignore_empty_values doesn't work for list types #48

Open
aantn opened this issue Nov 5, 2023 · 0 comments
Open

ignore_empty_values doesn't work for list types #48

aantn opened this issue Nov 5, 2023 · 0 comments
Labels
type:bug Something isn't working

Comments

@aantn
Copy link

aantn commented Nov 5, 2023

Describe the bug:
When setting ignore_empty_values=True, I would expect empty lists to not be returned by pydantic_input. Yet they are.

Possible Fix:
Update _is_value_ignored in ui_renderer.py to check type(value) == list as follows:

return (
            self._ignore_empty_values
            and (
                type(value) == int or type(value) == float or isinstance(value, str) or type(value) == list
            )  # only for int, float or str
            and not value
            and self._get_value(property_key) is None
        )

I've tested this and it works.

@aantn aantn added the type:bug Something isn't working label Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant