Skip to content

Commit bd579ce

Browse files
authored
Merge pull request #250 from dapper91/dev
- model deserialization additional arguments added. See #247
2 parents 1dc6a48 + 2d2734c commit bd579ce

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
2.15.0 (2025-03-29)
5+
-------------------
6+
7+
- model deserialization additional arguments added. See https://github.com/dapper91/pydantic-xml/issues/247
8+
9+
410
2.14.3 (2025-03-11)
511
-------------------
612

pydantic_xml/model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,19 @@ def from_xml_tree(cls: Type[ModelT], root: etree.Element, context: Optional[Dict
517517
)
518518

519519
@classmethod
520-
def from_xml(cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None) -> ModelT:
520+
def from_xml(
521+
cls: Type[ModelT], source: Union[str, bytes], context: Optional[Dict[str, Any]] = None, **kwargs: Any,
522+
) -> ModelT:
521523
"""
522524
Deserializes an xml string to an object of `cls` type.
523525
524526
:param source: xml string
525527
:param context: pydantic validation context
528+
:param kwargs: additional xml deserialization arguments
526529
:return: deserialized object
527530
"""
528531

529-
return cls.from_xml_tree(etree.fromstring(source), context=context)
532+
return cls.from_xml_tree(etree.fromstring(source, **kwargs), context=context)
530533

531534
def to_xml_tree(
532535
self, *, skip_empty: bool = False, exclude_none: bool = False, exclude_unset: bool = False,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pydantic-xml"
3-
version = "2.14.3"
3+
version = "2.15.0"
44
description = "pydantic xml extension"
55
authors = ["Dmitry Pershin <[email protected]>"]
66
license = "Unlicense"

0 commit comments

Comments
 (0)