Skip to content

Commit 39f8354

Browse files
authored
Merge pull request #74 from dapper91/minor-fixes
- custom root type serialization format changed - doc typos fixed
2 parents 4880e66 + 80eb45b commit 39f8354

File tree

22 files changed

+102
-74
lines changed

22 files changed

+102
-74
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ repos:
2525
args:
2626
- --fix=no
2727
- repo: https://github.com/asottile/add-trailing-comma
28-
rev: v2.4.0
28+
rev: v3.0.0
2929
hooks:
3030
- id: add-trailing-comma
3131
stages:
3232
- commit
3333
- repo: https://github.com/pre-commit/mirrors-autopep8
34-
rev: v2.0.1
34+
rev: v2.0.2
3535
hooks:
3636
- id: autopep8
3737
stages:
@@ -63,7 +63,7 @@ repos:
6363
- --multi-line=9
6464
- --project=pydantic_xml
6565
- repo: https://github.com/pre-commit/mirrors-mypy
66-
rev: v0.991
66+
rev: v1.4.1
6767
hooks:
6868
- id: mypy
6969
stages:
@@ -72,5 +72,5 @@ repos:
7272
pass_filenames: false
7373
args: ["--package", "pydantic_xml"]
7474
additional_dependencies:
75-
- pydantic
76-
- lxml-stubs
75+
- pydantic==1.9
76+
- lxml-stubs==0.4.0

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pydantic-xml extension
2222
:target: https://pydantic-xml.readthedocs.io/en/stable/
2323

2424

25-
``pydantic-xml`` is a `pydantic <https://docs.pydantic.dev>`_ extension providing model fields xml binding
25+
``pydantic-xml`` is a `pydantic <https://docs.pydantic.dev/1.10/>`_ extension providing model fields xml binding
2626
and xml serialization / deserialization.
2727
It is closely integrated with ``pydantic`` which means it supports most of its features.
2828

@@ -33,16 +33,16 @@ Features
3333
- flexable attributes, elements and text binding
3434
- python collection types support (``Dict``, ``List``, ``Set``, ``Tuple``, ...)
3535
- ``Union`` type support
36-
- pydantic `generic <https://pydantic-docs.helpmanual.io/usage/models/#generic-models>`_ models support
36+
- pydantic `generic <https://docs.pydantic.dev/1.10/usage/models/#generic-models>`_ models support
3737
- `lxml <https://lxml.de/>`_ xml parser support
3838
- ``xml.etree.ElementTree`` standard library xml parser support
3939

4040
What is not supported?
4141
______________________
4242

43-
- `dynamic model creation <https://docs.pydantic.dev/usage/models/#dynamic-model-creation>`_
44-
- `dataclasses <https://docs.pydantic.dev/usage/dataclasses/>`_
45-
- `discriminated unions <https://docs.pydantic.dev/usage/types/#discriminated-unions-aka-tagged-unions>`_
43+
- `dynamic model creation <https://docs.pydantic.dev/1.10/usage/models/#dynamic-model-creation>`_
44+
- `dataclasses <https://docs.pydantic.dev/1.10/usage/dataclasses/>`_
45+
- `discriminated unions <https://docs.pydantic.dev/1.10/usage/types/#discriminated-unions-aka-tagged-unions>`_
4646

4747
Getting started
4848
---------------
@@ -74,4 +74,4 @@ defines the XML document:
7474
</Company>
7575
7676
77-
Check `documentation <https://pydantic-xml.readthedocs.io/en/latest/>`_ for more information.
77+
See `documentation <https://pydantic-xml.readthedocs.io/en/latest/>`_ for more details.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Links
4040
-----
4141

4242
- `Source code <https://github.com/dapper91/pydantic-xml>`_
43-
- `Pydantic documentation <https://docs.pydantic.dev>`_
43+
- `Pydantic documentation <https://docs.pydantic.dev/1.10/>`_
4444

4545

4646
Indices and tables

docs/source/pages/data-binding/aliases.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Template models
4545

4646
``pydantic`` aliases make it possible to declare so-called template models.
4747
The base model implements all data-validation and data-processing logic and
48-
fields mapping is described in inherited classes:
48+
fields mapping is described in the inherited classes:
4949

5050
.. grid:: 2
5151
:gutter: 2

docs/source/pages/data-binding/attributes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ __________
77
Primitive types
88
***************
99

10-
Field of a primitive type marked as :py:func:`pydantic_xml.attr` is bound to a local element attribute.
10+
Field of a primitive type marked as :py:func:`pydantic_xml.attr` is bound to a local element attribute.
1111
Parameter ``name`` is used to declare the attribute name from which the data is extracted.
1212
If it is omitted field name is used (respecting ``pydantic`` field aliases).
1313

docs/source/pages/data-binding/elements.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ where ``ns`` is the element namespace alias and ``nsmap`` is a namespace mapping
120120
:start-after: json-start
121121
:end-before: json-end
122122

123-
Namespace mapping can be declared for a model. In that case all fields inherit that mapping:
123+
Namespace and namespace mapping can be declared for a model. In that case all fields
124+
:ref:`except attributes <pages/data-binding/attributes:namespace inheritance>` inherit them:
124125

125126
.. grid:: 2
126127
:gutter: 2

docs/source/pages/data-binding/generics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Generic models
55
______________
66

7-
``pydantic`` library supports `generic-models <https://pydantic-docs.helpmanual.io/usage/models/#generic-models>`_.
7+
``pydantic`` library supports `generic-models <https://docs.pydantic.dev/1.10/usage/models/#generic-models>`_.
88
To declare one inherit your model from :py:class:`pydantic_xml.BaseGenericXmlModel`,
99
the rest is the same as ``pydantic`` generic model declaration:
1010

docs/source/pages/data-binding/homogeneous.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Model homogeneous collection
5151

5252
Field of a model homogeneous collection type is bound to sub-elements. Then the sub-element is used
5353
as a root for that sub-model. For more information see :ref:`model data binding <pages/data-binding/models:model>`.
54-
Parameter ``tag`` is used to declare a sub-elements tag to which the sub-models are bound.
54+
Parameter ``tag`` is used to declare sub-elements tag to which the sub-models are bound.
5555
If it is omitted the sub-model ``tag`` parameter is used.
5656
If it is omitted too field name is used (respecting ``pydantic`` field aliases).
5757

docs/source/pages/data-binding/models.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ _____
77
Root model
88
**********
99

10-
Root model is bound the root xml element with the tag matching the model ``tag`` or class name.
10+
Root model is bound to the root xml element with the tag matching the model ``tag`` or class name.
1111
If the corresponding element not found :py:class:`pydantic_xml.ParsingError` exception is raised.
1212

1313
.. grid:: 2
@@ -88,7 +88,7 @@ Namespace mapping is inherited by all the model field:
8888
Custom root type
8989
****************
9090

91-
``Pydantic`` supports so-called `custom root type <https://docs.pydantic.dev/usage/models/#custom-root-types>`_.
91+
``Pydantic`` supports so-called `custom root type <https://docs.pydantic.dev/1.10/usage/models/#custom-root-types>`_.
9292

9393
It works for primitive types:
9494

@@ -192,7 +192,7 @@ and model types:
192192
Self-referencing models
193193
***********************
194194

195-
``pydantic`` library supports `self-referencing models <https://pydantic-docs.helpmanual.io/usage/postponed_annotations/#self-referencing-models>`_.
195+
``pydantic`` library supports `self-referencing models <https://docs.pydantic.dev/1.10/usage/postponed_annotations/#self-referencing-models>`_.
196196
Within the model, you can refer to a not-yet-constructed model using a string.
197197

198198
.. grid:: 2

docs/source/pages/data-binding/wrapper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Wrapper
44
_______
55

66
Some XML documents have deep element hierarchy which requires to declare a lot of "dumb" sub-models
7-
to extract the deepest element data. In such cases :py:func:`pydantic_xml.wrapped` can help.
7+
to extract the deepest element data. :py:func:`pydantic_xml.wrapped` helps to get rid of that.
88

99

1010
Wrapped entities

0 commit comments

Comments
 (0)