Skip to content

Commit

Permalink
Update docs and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Montague committed Aug 7, 2019
1 parent 2a4f0eb commit 21dd6a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions changes/715.rst
@@ -0,0 +1 @@
make all annotated fields occur in the order declared, #715 by @dmontagu
11 changes: 6 additions & 5 deletions docs/index.rst
Expand Up @@ -204,6 +204,12 @@ A few things to note on validators:
- If validation fails on another field (or that field is missing) it will not be included in ``values``, hence
``if 'password1' in values and ...`` in this example.

.. warning::

Be aware that mixing annotated and non-annotated fields may alter the order of your fields in metadata and errors,
and for validation: annotated fields will always come before non-annotated fields.
(Within each group fields remain in the order they were defined.)


.. note::

Expand Down Expand Up @@ -897,11 +903,6 @@ Required Fields and mypy

The ellipsis notation ``...`` will not work with mypy, you need to use annotation only fields as in the example above.

.. warning::

Be aware that using annotation only fields will alter the order of your fields in metadata and errors:
annotation only fields will always come first, but still in the order they were defined.

To get round this you can use the ``Required`` (via ``from pydantic import Required``) field as an alias for
ellipses or annotation only.

Expand Down

0 comments on commit 21dd6a5

Please sign in to comment.