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

Rename and Coerce do not work together #607

Open
aaron11496 opened this issue Aug 15, 2023 · 1 comment
Open

Rename and Coerce do not work together #607

aaron11496 opened this issue Aug 15, 2023 · 1 comment

Comments

@aaron11496
Copy link

>>> import cerberus
>>> cerberus.__version__
'1.3.4'
>>> from cerberus.validator import Validator
>>> Validator().normalized({'f': '123'}, schema={'f': {'type': 'integer', 'coerce': int}})
{'f': 123}
>>> Validator().normalized({'f': '123'}, schema={'f': {'type': 'integer', 'coerce': int, 'rename': 'g'}})
{'g': '123'}

I would expect the coerce to still take effect here. Please let me know whether this is intended behavior or if there is another way to do what I intended.

@funkyfuture
Copy link
Member

funkyfuture commented Oct 23, 2023

yes, it is a known issue that people walk into by intuition. be aware that validation rules are validated against the normalized document.

i keep this issue open as a reminder that admonitions that point people to the proper considerations should be added to the docs about schemas and normalization rules. also, the former should be renamed to just "Schemas". other documents and docstrings also still state "validation schemas" (sometimes joined w/ a dash) though they are meant generally.

@pyeve pyeve deleted a comment from aeoluszzff Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants