Traceback (most recent call last):
File "/Users/vancoykendall/.cache/uv/archive-v0/QihtkkAxr79L-UD496U5e/lib/python3.12/site-packages/pydantic_xml/serializers/factories/model.py", line 219, in deserialize
return self._model.model_validate(result, strict=False, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vancoykendall/.cache/uv/archive-v0/QihtkkAxr79L-UD496U5e/lib/python3.12/site-packages/pydantic/main.py", line 716, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for MyModel
a
Input should be a valid integer, unable to parse string as an integer [type=int_parsing]
For further information visit https://errors.pydantic.dev/2.12/v/int_parsing
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/vancoykendall/.cache/uv/archive-v0/QihtkkAxr79L-UD496U5e/lib/python3.12/site-packages/pydantic_xml/model.py", line 290, in from_xml
return cls.from_xml_tree(etree.fromstring(source, **kwargs), context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vancoykendall/.cache/uv/archive-v0/QihtkkAxr79L-UD496U5e/lib/python3.12/site-packages/pydantic_xml/model.py", line 264, in from_xml_tree
ModelT, cls.__xml_serializer__.deserialize(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vancoykendall/.cache/uv/archive-v0/QihtkkAxr79L-UD496U5e/lib/python3.12/site-packages/pydantic_xml/serializers/factories/model.py", line 221, in deserialize
raise utils.set_validation_error_sourceline(err, sourcemap)
pydantic_core._pydantic_core.ValidationError: 1 validation error for MyModel
a
[line -1]: Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='bad input', input_type=str]
So it raises 2 ValidationErrors, one from the other and one respects the model config and one doesn't.
If I set
hide_input_in_errors=Trueon aBaseXmlModel's model_config, ValidationErrors raised byfrom_xml_tree(andfrom_xml) don't remove the input. The issue stems from the ModelSerializer and RootSerializer using these util functions to rebuild ValidationErrors.Minimal Example:
traceback
So it raises 2 ValidationErrors, one from the other and one respects the model config and one doesn't.